Works for me, I've no idea why it doesn't work for you. If you don't
have fields use PdfSmartCopy. PdfStamper isn't doing anything here.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Don Hedman
> Sent: Wednesday, April 09, 2008 1:39 PM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] iText addDocument() question
>
> I'm SURE that this has been addressed many times over so my
> apologies if I have missed it. I am trying to append several
> PDF files together using the addDocument() method. My code
> is below. What results when I run this is that I get the
> correct NUMBER of documents but only the first document
> several times (if I sent an array of 3 filenames I get a
> final output file with three copies of the first file in the
> array). What am I missing?
>
>
>
> public static void concatPDFs(String[] pdfFileNames,
> String outputfilename) {
>
> try {
>
> ByteArrayOutputStream baos = new
> ByteArrayOutputStream();
>
> PdfCopyFields copy = new PdfCopyFields(baos);
>
> for (int i = 0; i < pdfFileNames.length; i++) {
>
> copy.addDocument(new
> PdfReader(pdfFileNames[i]));
>
> }
>
> copy.close();
>
> PdfReader reader = new
> PdfReader(baos.toByteArray());
>
> PdfStamper stamper = new PdfStamper(reader,
> new FileOutputStream(outputfilename));
>
> stamper.close();
>
> } catch (Exception e) {
>
> e.printStackTrace();
>
> } finally {
>
> }
>
> }
>
>
>
>
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar