Hello,
I just decovered a bug in PdfStamperImp (line 216). PdfStamperImp tries to read
producer info from (oldInfo) PdfDictionary whenever oldInfo is not null. But
producer information may in some cases not be contained in the oldInfo.
However, PdfStamperImp expects producer info to be available if oldInfo is not
null and wants to read it which causes a NullpointerException.
I fixed the code this way:
int skipInfo = -1;
PRIndirectReference iInfo =
(PRIndirectReference)reader.trailer.get(PdfName.INFO);
PdfDictionary oldInfo = (PdfDictionary)PdfReader.getPdfObject(iInfo);
String producer = null;
if (iInfo != null)
skipInfo = iInfo.getNumber();
if (oldInfo != null)
if (oldInfo.getAsString(PdfName.PRODUCER) != null)
producer = oldInfo.getAsString(PdfName.PRODUCER).value;
else
producer = "unknown";
if (producer == null) {
producer = Document.getVersion();
}
else if (producer.indexOf(Document.getProduct()) == -1) {
StringBuffer buf = new StringBuffer(producer);
buf.append("; modified using ");
buf.append(Document.getVersion());
producer = buf.toString();
}
Kind regards
Markus Zuberbühler
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/