Hi
You should try examples of iText in Action 2
You're using an old iText version that is no longer supported. Consider
upgrading.
Regards
Balder
On 16/04/2011 12:32, [email protected] wrote:
Hello there,
I tried to copy a page of pdf file in a new one. I followed the step
in the iText Chapter 6. However, I get four exceptions:
at
com.lowagie.text.pdf.PdfWriter.getPdfIndirectReference(PdfWriter.java:1643)
at com.lowagie.text.pdf.PdfImportedPage.<init>(PdfImportedPage.java:68)
at
com.lowagie.text.pdf.PdfReaderInstance.getImportedPage(PdfReaderInstance.java:89)
at com.lowagie.text.pdf.PdfCopy.getImportedPage(PdfCopy.java:163)
Here are my codes, I tested the SrcFileName, page and filepath. All of
them are correct.
doc.open();
String SrcFileName = viewer.getFileName();
//System.out.println(SrcFileName);
int page=((Integer)viewer.executeCommand(Commands.CURRENTPAGE,
null)).intValue();
//System.out.println(page);
//System.out.println(filepath);
PdfReader pdfReader = new PdfReader(SrcFileName);
PdfCopy pdfCopy = new PdfCopy(doc, new FileOutputStream(new
File(filepath)));
PdfImportedPage impPage = pdfCopy.getImportedPage(pdfReader, page);
pdfCopy.addPage(impPage);
doc.close();
I don't know what's wrong with my codes. Any hints are appreciated~!
Thanks in advance~~~
Chen
------------------------------------------------------------------------------
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
--
@redlabbe <http://twitter.com/redlabbe>
redlab-log <http://www.redlab.be/blog>
------------------------------------------------------------------------------
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