Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Direct Content

Henry Doan

2006-06-16

Replies:

I am using PdfStamper to write some text a an exiting pdf but its not
writting the text here is my code: Thanks in advance


// GET THE FILE
 PdfReader reader = new PdfReader("e:/Hello World 7.pdf");

 PdfStamper stamper = new PdfStamper(reader, baos);

 PdfContentByte cb = stamper.getUnderContent(1);

 // PdfTemplate
       PdfTemplate template = cb.createTemplate(500, 200);

 template.beginText();
       BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
       template.setFontAndSize(bf, 12);
       template.setTextMatrix(100, 100);
       template.showText("SOME TEXT HERE");
       template.endText();

 cb.addTemplate(template, 0, 0);

 reader.close();

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.