Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] RE: Interleaving pages from two existing PDFs with iText?

Paulo Soares

2003-10-31

Replies:

The problem is that PdfCopy can't duplicate pages. You must read the
separator.pdf as many times as you are including it. Actually read it only
once and duplicate it with the constructor PdfReader(PdfReader).

Best Regards,
Paulo Soares

> -----Original Message-----
> From:  Andrzej Jan Taramina [SMTP:andrzej@(protected)]
> Sent:  Friday, October 31, 2003 5:37
> To:  itext-questions@(protected)
> Cc:  psoares@(protected)
> Subject:  Interleaving pages from two existing PDFs with iText?
>
> I'm trying to create a routine that will take an existing single-page pdf
> called separator.pdf (just a blank page actually), and interleave that
> between the pages of another doc.pdf.
>
> For example, if document.pdf has 3 pages, the output should be:
>
> doc page 1
> separator page 1
> doc page 2
> separator page 1
> doc page 3
> separator page 1
>
> In case anyone is curious, this is to handle printing on duplex printers,
> where you don't want the pdf to be printed duplex.
>
> I've modelled my code on the code in com.lowagie.tools.concat_pdf, and
> though
> I can append a separator after a whole document, if I try to interleave
> the
> separator page in between the document pages, I end up with a corrupt pdf
> file produced.
>
> I tried using the same document and writer (PDFCopy) objects for both the
> doc.pdf and separator.pdf files, but that doesn't work.
>
> I then tried to create different document and writer objects for both the
> doc.pdf and separator.pdf files, with the ones for the separator only used
> to
> read the separator page, but again, it fails with a corrupt pdf being
> produced. This would seem to be because internally the reader, document,
> writer and page are all interdependent, and introducing a different
> reader/page with a writer.addPage() call screws something up internally.
>
> It seems that there is no obvious way to do this with iText.
>
> Can anyone point me in the right direction as to how to do this kind of
> interleaving?
>
> Thanks!
>
>
>
>
> Andrzej Jan Taramina
> Chaeron Corporation: Enterprise System Solutions
> http://www.chaeron.com


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions


©2008 junlu.com - Jax Systems, LLC, U.S.A.