On 16/09/2010 14:44, jerrin.cvarghese wrote:
>
>>> The annotations are in the /Annots entry of the
> page dictionary. You could try to fetch them,
> apply a transformation to the rectangle that defines
> their position, and copy them into the new document
>
> I am randomly using many pdfs and so will not be sure on the exact
> position of this annotations. I tried to get these annotations from the page
> dictionary and write it to the new PDf but it fails .
>
> My Code:
> --------
> PdfReader pdfReader= **
> pdfWriter = PdfWriter.getInstance(pdfDocument,new
> FileOutputStream("C:/final.pdf"));
> pdfDocument.open();
>
> //Lets consider pageN = 1
> pageDic = pdfReader.getPageN(pageN);
> pdfWriter.addToBody(pdfReader.getPdfObject(pageDic.get(PdfName.ANNOTS)) );
Wow no, that's a serious shortcut you're trying to take here.
I sincerely hope you didn't expect that to work.
Did you read part 4 of the second edition of iText in Action?
Start there, and come back later once you've mastered chapter 13.
Nothing we can say to help you will be of value to you if you don't
understand part 4 of "iText in Action".
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
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/