On 2012-03-29 13:33, Leonard Rosenthol wrote: > On 3/29/12 10:20 AM, "Michel Onoff" <[email protected]> wrote: > >> I need to regenerate PDF docs not created by iText, e.g., to change the >> PDF version, to make them a little bit more compact, to get rid of small >> errors or to resize Letter documents to A4. > > So that's not regeneration - that's just modification/processing. >
The only explicit processing, apart from copying all pages, is the resizing in case of an original document larger than A4. For the rest I rely on the PdfReader to smooth out small syntactical errors in the original PDF and on the PdfWriter to produce correct syntax on the copy. > >> I found the solution with page templates somewhere > > Do you own a copy of the iText book? Have you read it yet?? It will > explain to you why your method isn't a good one. > Indeed, it is from section 6.2 of the iText book (I've the 2nd MEAP early access edition at hand) that I learned the code that I'm using. The book samples make use of templates to copy pages from an existing document. It's not exactly the same context as my case (the samples do superimposing and n-up copying) but they're quite close to what I want, so I adapted the sample code to my needs. > >> , and it usually works quite well, > > No, it doesn't. You just aren't realizing the damage you are doing :(. > I'm using the code satisfactorily since months. A couple of days ago I encountered the first example of original PDF that includes OCGs and this is not regenerated as expected. So, you're right, the code is producing some damage when the original PDF contains OCGs. Of course, anybody that has some ideas pointing in the right direction or even a solution that works more reliably is welcome to post them/it. ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
