>> I'm using PdfCopy to bring in a batch of disparate types to a destination
PDF
>> file.  I'm currently seeing a problem where PdfWriter works fine, but
>> PdfCopy (a subclass of PdfWriter) fails.
>
> This is documented: PdfCopy can only be used to assemble pages
> from different PDFs without changing them. If you want to add
> an image to each of these pages, you'll have to do it in two
> passes: first assemble the new PDF with PdfCopy; then add the
> image with PdfStamper. Note that you don't need to write the
> intermediary PDF to a file; normally we keep temporary files
> in memory using a ByteArrayOutputStream (unless memory is a
> more crucial factor than speed in your application).

Ok, thanks for your reply and the info.

I'd like to make the suggestion that the API would have been more helpful if
it had signaled an error at an earlier stage.  The code:

boolean added = doc.add( image ); 

... could have thrown an IllegalArgumentException, or perhaps returned
false.   If I had been adding other content from PDF files, I might have
missed entirely that the images were not getting correctly copied into the
destination PDF.
-- 
View this message in context: 
http://www.nabble.com/Using-PdfCopy-with-image-results-in-%22The-document-has-no-pages%22-tf3801508.html#a10768931
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to