#29 System.Xml.XmlException when attempting to parse v1.2 PDF
XMP (1)

PDF Clown v0.1.1.0.
PDF Version: v1.2 (Acrobat 3.x).
PDF Producer: Acrobat Distiller 5.0.2 for Macintosh.
When attempting to access this property:
It reports the following:
\'pdfDoc.Metadata.Content\' threw an exception of type \'System.Xml.XmlException\'
Message: \"\'dc\' is an undeclared namespace. Line 4, position 2.\"

Unable to upload PDF doc as it is 3MB and SourceForge limit is 256KB - can email directly on request or upload to share site.
Another PDF document with the same PDF version, but created with a different \'producer\' is OK.


  • Stefano Chizzolini

    Apparently your XMP serialization is invalid as it omitted to bind the "dc" namespace prefix (which is typically associated to Dublin Core metadata) to its namespace declaration, like this:

      x:xmptk="XMP Core 5.4.0"
    . . .

    If that's the case, the problem is up to the file producer -- in order to work around this parsing issue, you have to programmatically get the metadata stream and read its contents with a more relaxed parser:

    import org.pdfclown.bytes.IBuffer;
    import org.pdfclown.objects.PdfStream;
    PdfStream metadataStream = 
    IBuffer contentBody = metadataStream.getBody();
    . . . // Read the buffer using your parser.
  • Stefano Chizzolini

    • labels: --> XMP
    • status: open --> wont-fix
    • assigned_to: Stefano Chizzolini
    • Group: -->

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks