Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] How to add new page?

Henry Doan

2006-06-20

Replies:

Ok the question seem simple but its a bit complicated because i tried using
Document.newPage() and it didnt' work with my code.
All i am doing is opening an exisiting PDF file and putting some direct
content into it but i want to do the same thing BUT on the 2nd page. Now
thats where i am really stuck...i don't know if its possible or how to add a
2nd page and do the same thing to it as i did to the 1st page.

Sorry if this seem confusing but here is my code for the first page: Thank
you so much in advance!!!

ByteArrayOutputStream baos = new ByteArrayOutputStream();

   // GET THE FILE
   PdfReader reader = new PdfReader("e:/Webs/walton/ICF.pdf");
   PdfStamper stamper = new PdfStamper(reader, baos);
   PdfContentByte cb = stamper.getUnderContent(1);

   // PdfTemplate
   PdfTemplate template = cb.createTemplate(200,35);
   template.beginText();// BEGIN CUST NAME/ADD
     BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA_BOLD,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
     template.setFontAndSize(bf, 8);
     template.setTextMatrix(0, 29);
     template.setLeading(7.4f);
     template.showText(strCompany);
     template.newlineShowText(strAdd_Address);
     template.newlineShowText("ADDRESS 2");
     template.newlineShowText(strAdd_City + " ,"+strAdd_State+" "+strAdd_Zip);
     template.endText();
   //                X   Y
   cb.addTemplate(template, 44, 610);

_________________________________________________________________
Don?t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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