Hello,

how can I set the absolute position for a Chunk ?

Thanks
Angelika


My Example:

import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class ItextExample {

        public static void main(String[] args) throws DocumentException, 
MalformedURLException, IOException {

                Document document = new Document(PageSize.A4, 10, 10, 10, 10);
                PdfWriter pdfWriter = PdfWriter.getInstance(document, new 
FileOutputStream("1_ItextExample.pdf"));

                // How can i set the absolute position for this chunk ?
                Chunk headline = new Chunk("My content");
                headline.setBackground(new Color(255, 0, 0), 5, 5, 5, 5);

                document.open();

                PdfContentByte cb = pdfWriter.getDirectContent();
                BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, 
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                cb.beginText();
                cb.setFontAndSize(bf, 14);
                cb.setTextMatrix(100, 600);
                cb.showText("Chunk is not allowed :("); // Chunk with 
background color is not allowed.
                cb.endText();
                
                document.add(headline);

                document.close();
        }

}


-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to