PdfReader reader = new PdfReader("/tmp/a.pdf");
PdfStamper stamper = new PdfStamper(reader, new
FileOutputStream("/tmp/b.pdf"));
PdfContentByte under = stamper.getUnderContent(1);
stamper.addFileAttachment(null, null, "/tmp/a.xml", "a.xml");
stamper.close();

That seems to be ok. I wonder why getUnderContent(1) copies the whole pdf?

http://api.itextpdf.com/ says:
public PdfContentByte getUnderContent(int pageNum)
    Gets a PdfContentByte to write under the page of the original document. 

Where can i find such a documentation for iText 2.1.7?

-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Lose-existing-Bookmarks-and-Attachments-with-PdfCopy-tp2239965p2240171.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
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