I'm using PDFMergerUtility to merge a number of PDF input streams and write
them to an HTTP response output stream. One of the PDFs is failing at line
667 in PDFParser:
final COSName objectType = (COSName)strmObj.getItem( COSName.TYPE );
The result of getItem(COSName.TYPE) is a COSString (value "Metadata") and
not a COSName.
I have patched this locally by changing the code to the following:
COSBase baseObject = (COSBase)strmObj.getItem( COSName.TYPE );
COSName objectType = null;
if (baseObject instanceof COSString) {
String baseObjectValue = ((COSString)baseObject).getString();
objectType = COSName.getPDFName(baseObjectValue);
}
else
{
objectType = (COSName)baseObject;
}
With this change, I am able to merge my PDF input streams without error.
Does this seem like an acceptable change (that should be submitted as a
patch) or am I missing something? The PDFs being merged are viewable by
Chrome's internal PDF viewer as well as OSX Preview, Adobe Reader and
Bluebeam Vu/Revu.
Thanks!