You only told it to copy a single page
    copy.addPage(copy.getImportedPage(reader,1));

Instead, try this line in place of both your copy.addPage lines.
    copy.addDocument(reader);

Regards,
Howard Shank

----- Original Message ----
From: ayeen <[EMAIL PROTECTED]>
To: itext-questions@lists.sourceforge.net
Sent: Friday, May 9, 2008 12:31:25 PM
Subject: [iText-questions] merging PDF1 and PDF2 but page 2 of PDF1 gets lost



hi...

i was trying to merge two pdf files, pdf1.pdf and pdf2.pdf.... pdf1.pdf has
2 pages, pdf2.pdf just has 1.... after merging them, page 2 of pdf1.pdf gets
lost and instead of having 3 pages i only have 2 pages...... below are my
codes:

PdfReader reader = new PdfReader("pdf1.pdf");//first page
Document document = new Document(reader.getPageSizeWithRotation(1));
PdfCopy copy = new PdfCopy(document, new FileOutputStream(merged.pdf));
document.open();
copy.addPage(copy.getImportedPage(reader,1));

reader = new PdfReader("pdf2.pdf");
copy.addPage(copy.getImportedPage(reader,1));
document.close();


did i forget to include something in my codes?
thanks in advance!


-- 
View this message in context: 
http://www.nabble.com/merging-PDF1-and-PDF2-but-page-2-of-PDF1-gets-lost-tp17151676p17151676.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


-------------------------------------------------------------------------
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

Reply via email to