Op 17/04/2011 13:52, [email protected] schreef:
Hello,

Thank you for your advice~~~The PdfCopy works now~~~
OK.
but the thing is I want to keep adding pages into the dest file everytime I invoke the method, but the result is only the last page I choose will remine in the dest file. I think the previous ones are covered by the last one. Is there an InsertAfter()? Or AddNewPage() can help me out??

With PdfCopy you can't cover one page with another.

This creates a reader object:

PdfReader pdfReader = new PdfReader(SrcFileName);

This creates a PdfCopy object.
It will create a NEW file with name filepath every time you create a PdfCopy object.

PdfCopy pdfCopy = new PdfCopy(doc, new FileOutputStream(new File(filepath)));
PdfImportedPage impPage = null;

doc.open();

This adds the page with number page to the new file with name PdfCopy.

impPage = pdfCopy.getImportedPage(pdfReader, page);
pdfCopy.addPage(impPage);
doc.close();

Upon close, you've created a new page.

I don't think you're creating a document where all pages cover each other.
I think you're creating X documents where X is the number of pages you're trying to copy.
I think you're overwriting each file.

That's not what is done in the book, is it?

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
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

Reply via email to