You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Pat Hickey (JIRA)" <ji...@apache.org> on 2014/01/31 00:16:09 UTC
[jira] [Commented] (PDFBOX-1872) PDMetadata.exportXMPMetadata fails
when Metadata has encrypted stream
[ https://issues.apache.org/jira/browse/PDFBOX-1872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887231#comment-13887231 ]
Pat Hickey commented on PDFBOX-1872:
------------------------------------
Forget that workaround - I was looking at the wrong document. It ends up with the encrypted data, as well.
> PDMetadata.exportXMPMetadata fails when Metadata has encrypted stream
> ---------------------------------------------------------------------
>
> Key: PDFBOX-1872
> URL: https://issues.apache.org/jira/browse/PDFBOX-1872
> Project: PDFBox
> Issue Type: Bug
> Components: JempBox, PDModel
> Affects Versions: 1.8.3
> Environment: Not sure it matters, but Solaris (SunOS 5.10), java 1.6.0_19,
> Reporter: Pat Hickey
> Priority: Minor
>
> My guess is that PDDocumentCatalog.getMetadata() gives PDMetadata the raw stream, instead of the filtered one. Then PDMetadata.exportXMPMetadata() calls XMPMetadata.load(), which cannot parse the encrypted stream.
> As a workaround, this seems to do the trick (where document is the PDDocument loaded from the PDF):
> String content = null;
> COSStream md = (COSStream)document.getDocument().getCatalog().getDictionaryObject( COSName.METADATA );
> if ( md != null ) {
> PDStream pd = new PDStream( md );
> content = pd.getInputStreamAsString();
> }
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)