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

Andreas edited comment on PDFBOX-2659 at 2/3/15 2:41 PM:
---------------------------------------------------------

I have run into the same issue. Margus IIgner's suggestion is correct. But 
applying a fix exposes a side-effect.

Using PdfBox 1.8.8, I create a PDF/A-3B document from a PDF/A-1 one. Adding a 
title to a DublinCoreSchema, leads to a validation error. The issue is 
restricted to the XmpBox library. The AbstractStructureType.createTextType 
picks up the namespace prefix defined for the DublinCoreSchema (let's say the 
predefined one, "dc") instead of using "rdf" (XmpConstants.DEFAULT_RDF_PREFIX). 
The fix is straight forward, adding a method that allows a prefix argument and 
using it wherever a XmpConstants.LIST_NAME TextType is used.

Side-effect: the title element after the fix still fails validation. The 
dc:title, rdf:Alt, rdf:li must also include a xml:lang attribute. But the field 
created for rdf:li is of type AbstractSimpleProperty. Attributes for such 
fields are not writen into the stream by the XmpSerializer unlike atrributes 
for fields of type ArrayProperty. The XmpSerializer.fillElementWithAttributes 
method also seems to be ignoring the namespace entries for attributes. The 
method also includes an "else if" clause that does the exact same thing as the 
else clause.

Having applied the necessary changes to overcome this issue, a valid PDF/A-3 
containing a DublinCoreSchema element of tyoe title can be generated (the tests 
pass too). How can I help you guys out?


was (Author: andkyr):
I have run into the same issue. Margus IIgner's suggestion is correct. But 
applying a fix exposes a side-effect.

Using PdfBox 1.8.8, I create a PDF/A-3B document from a PDF/A-1 one. Adding a 
title to a DublinCoreSchema, leads to a validation error. The issue is 
restricted to the XmpBox library. The AbstractStructureType.createTextType 
picks up the namespace prefix defined for the DublinCoreSchema (let's say the 
predefined one, "dc") instead of using "rdf" (XmpConstants.DEFAULT_RDF_PREFIX). 
The fix is straight forward, adding a method that allows a prefix argument and 
using it whereever a XmpConstants.LIST_NAME TextType is used.

Side-effect: the title element after the fix still fails validation. The 
dc:title, rdf:Alt, rdf:li must also include a xml:lang attribute. But the field 
created for rdf:li is of type AbstractSimpleProperty. Attributes for such 
fields are not writen into the stream by the XmpSerializer unlike atrributes 
for fields of type ArrayProperty. The XmpSerializer.fillElementWithAttributes 
method also seems to be ignoring the namespace entries for attributes. There is 
an else if clause that does the exact same thing as the else clause.

Having applied the necessary changes to overcome this issue, a valid PDF/A-3 
containing a DublinCoreSchema element of tyoe title can be generated (the tests 
pass too). How can I help you guys out?

> Dublin Core: Title not defined
> ------------------------------
>
>                 Key: PDFBOX-2659
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2659
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Preflight
>    Affects Versions: 1.8.8
>            Reporter: Marcus Ilgner
>            Priority: Minor
>              Labels: pdf/a
>         Attachments: invoice.pdf
>
>
> Validating a PDF for A1 compatibility, I get an error:
> {quote}
> Error on MetaData, Title present in the document catalog dictionary can't be 
> found in XMP information (Property is not defined)
> {quote}
> Yet when I look at the file, the property is defined as such:
> {code}
>       <dc:title>
>         <rdf:Alt>
>           <dc:li>Rechnung 14512-14-001</dc:li>
>         </rdf:Alt>
>       </dc:title>
> {code}
> The code that sets the title (in order to make sure it's the same as the one 
> from the document information):
> {code}
>         DublinCoreSchema dublinCore = xmp.createAndAddDublinCoreSchema();
>         dublinCore.setTitle("x-default", docInfo.getTitle());
> {code}
> Setting the creator via DublinCoreSchema seems to work as it doesn't raise 
> the error anymore after calling 
> {code}dublinCore.addCreator(docInfo.getAuthor());{code}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to