Given that the iText APIs aren't going to give you full access to every feature possible in an Annotation dictionary, not to mention support for private data that could be present, this method is doomed to failure.
-----Original Message----- From: Fabrizio Arosio [mailto:[email protected]] Sent: Tuesday, September 29, 2009 9:10 AM To: Post all your questions about iText here Subject: Re: [iText-questions] Concatenating pdf while preserving annotations Many thanks for your response. My approach is to manually build PdfAnnotation objects starting from imported pages' annotation dictionaries. I would then add these PdfAnnotation objects to the PdfWriter. Even if it is not the most appropriate way, do you think it is sufficient to perform the task? Or are you saying that this approach could be the source of future problems? Fabrizio ----- Messaggio originale ----- Da: Leonard Rosenthol <[email protected]> A: "[email protected]" <[email protected]> Inviato: Martedì 29 settembre 2009, 12:30:57 Oggetto: Re: [iText-questions] Concatenating pdf while preserving annotations There are other ways, but they require low level manipulation of the PDF data structures and content stream... -----Original Message----- From: Fabrizio Arosio [mailto:[email protected]] Sent: Tuesday, September 29, 2009 4:27 AM To: [email protected] Subject: [iText-questions] Concatenating pdf while preserving annotations Hello to all. I need to concatenate a number of pdf files into a single pdf. Every page of source pdfs have to be resized and centered into the output page (actual resizing, i.e. not changing page boundaries). The problem is that the interactive features of source page have to be kept (at least link annotations). I cannot use both PdfStamper nor PdfCopy (they don't keep interactive features) but only the PdfWriter class, by extracting the annotations from source pages, scale them and finally add to the output document as a template the scaled PdfImportedPage, together with the annotations. This require some work, so I started trying to preserve only link annotations, and I found that the PdfReader.getLinks() method, the PdfAnnotation.PdfImportedLink class, together with PdfWriter.addAnnotation() method could do the work. But it seems to me that PdfReader.getLinks() and PdfAnnotation.PdfImportedLink have the limitation to handle link annotation with (indirect) explicit destinations only, excluding named destinations and link annotations with /GoTo actions. So I came up with the idea of extracting from the source page dictionary the annotation dictionary, handling it, and putting it into the page's dictionary. This seems to me a hard task as I don't know how to handle with indirect objects referenced by the annotation dictionary items, and probably I would need to investigate how PdfWriter works in its internals. Another solution could be to create a PdfAnnotation object from the source page's annotation dictionary, scale it, and then add it to the output document. Can you guys please give me an advice: am I on the right way or am I doing something wrong? Thanks in advance, Fabrizio __________________________________________________ Do You Yahoo!? Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi http://mail.yahoo.it ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php 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/ ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php 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/
