Hello,
I got this following method;
InputStream input = null;
try {
input = new BufferedInputStream(new
FileInputStream("/template- authority.pdf"));
} catch (IOException e) {
logger.error("Error opening file region", e);
}
ByteArrayOutputStream bout = new ByteArrayOutputStream();
try {
PdfReader reader = new PdfReader(input);
PdfStamper stamper = new PdfStamper(reader,bout);
ByteArrayOutputStream pdfStream = new
ByteArrayOutputStream();
..
..
// new code to copy pdf
Document document = new
Document(reader.getPageSizeWithRotation(1));
if (document == null) { logger.debug("dec :document is null
"); }
PdfCopy copy = new PdfCopy(document, bout);
if (copy == null) { logger.debug("dec :copy is null ");
}
document.open();
PdfImportedPage page = copy.getImportedPage(reader, 1);
if (page == null) { logger.debug("dec :page is null ");
}
copy.addPage(page);
document.close();
copy.addPage(page);
document.close();
//end new code
//stamper.close();
} catch (Exception e) {
logger.error("Error opening file region", e);
}
int length = 0;
byte[] bytes = new byte[(int)length];
try {
bytes = bout.toByteArray();
bout.close();
input.close();
} catch (IOException e) {
logger.error("Error reading bytes", e);
}
return bytes;
I have try the PdfCopy, I'm not sure where did I went wrong,
But its gives an corrupted pdf, it works fine without the new code section,
All the above debuggers are work fine without any null errors :(
Can some one help pls
Dilan
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions