I have been learning iText and have been able to merge field into a cover
letter using the PdfStamper.
In the end design, I would like to:
-- Open one output stream.
-- Merge cover fields into cover letter and output to the output stream.
-- Add pages to the end of this output stream from a different PDF report
file.
To do this, I was trying to use the PdfStamper, but then try to append the
report pages as follows.
PdfReader rrReader = new PdfReader(filePath);
int numRrPages = rrReader.getNumberOfPages();
for (int i = 0; (i < numRrPages); i++) {
targetWriter.getImportedPage(rrReader, i);
stamperWriter.addPage(copy.getImportedPage(rrReader, i));
}
I am getting an error as shown at the bottom. Am I going about this the
right way? Is this the best method? Is there a better method? The cover
letter code alone works great. Just need to be able to append the file.
Thanks for any help.
-----------------
java.lang.IllegalArgumentException: Invalid page number
at com.lowagie.text.pdf.PdfReaderInstance.getImportedPage(Unknown
Source)
at com.lowagie.text.pdf.PdfWriter.getImportedPage(Unknown Source)
at com.lowagie.text.pdf.PdfStamper.getImportedPage(Unknown Source)
at
com.ert.expert.send.mail.mailcreation.filetype.PdfMailCreation.streamRawReport(PdfMailCreation.java:189)
--
View this message in context:
http://www.nabble.com/Merging-fields-in-cover-letter-then-merging-report-tf4694005.html#a13417210
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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/