I have a program that is reading one PDF and adding a note to it and 
writing another PDF.    Unfortunately, it is shifting the original 
document upward so that some of the original content is virtually 
printed above the top of the page.  I am not sure what I am doing wrong.

         Document document = null;
         document=new Document(new Rectangle(11*72, (int)8.5*72), 0, 
0,   0,  0);  // I have tried different margin numbers
         PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream(newFileName));

         document.addTitle("title here");
         document.addAuthor("...");
         document.addCreator("viaPeople using iiText");
         document.open();

         PdfContentByte cb = writer.getDirectContent();
         PdfReader reader = new PdfReader(_fileName);
         int n = reader.getNumberOfPages();

         PdfImportedPage page;
         int rotation;
         int i = 0;

         while (i < n)
         {
             i++;
             document.newPage();
             document.setPageSize(reader.getPageSizeWithRotation(i));

             page = writer.getImportedPage(reader, i);
             rotation = reader.getPageRotation(i);
             cb.addTemplate(page,0,0);

             ... my added text here...
         }


         document.close();


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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