Hi,

I'd replace this lines

final COSName objectType = (COSName)strmObj.getItem( COSName.TYPE ); if( objectType != null && objectType.equals( COSName.XREF ) )

by this line:

if (COSName.XREF.equals(strmObj.getItem(COSName.TYPE)))


Can you share the file? If yes, please attach the file to this issue, or upload it to a public place and I'll attach it myself if you don't want to register.

https://issues.apache.org/jira/browse/PDFBOX-2903

Tilman

Am 24.07.2015 um 16:46 schrieb [email protected]:
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!



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to