[ 
https://issues.apache.org/jira/browse/PDFBOX-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167678#comment-13167678
 ] 

Eric Leleu edited comment on PDFBOX-1188 at 12/12/11 6:58 PM:
--------------------------------------------------------------

Hi,

I checked different methods in the PDFBox project to know what is the behaviour 
when a dictionary contains a unexpected type. 
Sometime an exception is thrown and sometime null is returned.

In my opinion throwing an exception should be the right thing.

Unfortunately, even if we ignore this error the file test6.pdf isn't, according 
to me, a valid PDF/A because of the object "7 0" is referenced as a Metadata 
stream but this stream contains a Filter entry. 
According to the PDF/A specification : 
"Metadata object stream dictionaries shall not contain the Filter key.

The explicit prohibition of the Filter key has the implicit effect of 
preserving the contents of XMP Metadata streams as plain text that is visible 
to  non-PDF aware tools."


                
      was (Author: leleueri):
    Hi,

I check different methods in the PDFBox project to know what is the behaviour 
when a dictionary contains a unexpected type. 
Sometime an exception is thrown and sometime null is returned.

In my opinion throwing an exception should be the right thing.

Unfortunately, even if we ignore this error the file test6.pdf isn't, according 
to me, a valid PDF/A because of the object "7 0" is referenced as a Metadata 
stream but this stream contains a Filter entry. 
According to the PDF/A specification : 
"Metadata object stream dictionaries shall not contain the Filter key.

The explicit prohibition of the Filter key has the implicit effect of 
preserving the contents of XMP Metadata streams as plain text that is visible 
to  non-PDF aware tools."


                  
> PDStream Exception  when using a Cast
> -------------------------------------
>
>                 Key: PDFBOX-1188
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1188
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel, Preflight
>            Reporter: William Fausser
>            Assignee: Eric Leleu
>             Fix For: 1.7.0
>
>         Attachments: bill_outPDFA.pdf, font_bad_metadata.patch, test6.pdf
>
>
> For some PDF/A, getDictionaryObject does not return COSStream but other 
> COSDictionary (super class)
> public PDMetadata getMetadata()
> {
>     PDMetadata retval = null;
>     COSStream mdStream = (COSStream)stream.getDictionaryObject( 
> COSName.METADATA );
>     if( mdStream != null )
>     {
>         retval = new PDMetadata( mdStream );
>     }
>     return retval;
> }
> org.apache.pdfbox.cos.COSDictionary cannot be cast to 
> org.apache.pdfbox.cos.COSStream
> at org.apache.pdfbox.pdmodel.common.PDStream.getMetadata(PDStream.java:508)
> at 
> net.padaf.preflight.font.AbstractFontValidator.checkFontFileMetaData(AbstractFontValidator.java:162)
> at 
> net.padaf.preflight.font.Type1FontValidator.checkFontFileElement(Type1FontValidator.java:228)
> at 
> net.padaf.preflight.font.Type1FontValidator.checkFontDescriptor(Type1FontValidator.java:125)
> at 
> net.padaf.preflight.font.SimpleFontValidator.validate(SimpleFontValidator.java:264)
> at 
> net.padaf.preflight.helpers.FontValidationHelper.validateFont(FontValidationHelper.java:107)
> at 
> net.padaf.preflight.helpers.FontValidationHelper.innerValidate(FontValidationHelper.java:90)
> at 
> net.padaf.preflight.helpers.AbstractValidationHelper.validate(AbstractValidationHelper.java:87)
> at 
> net.padaf.preflight.AbstractValidator.runValidation(AbstractValidator.java:134)
> at net.padaf.preflight.PdfA1bValidator.validate(PdfA1bValidator.java:90)
> at net.padaf.preflight.Validator_A1b.main(Validator_A1b.java:47)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to