System.Xml.XmlException when attempting to parse v1.2 PDF
General-Purpose PDF Library for Java and .NET
Status: Beta
Brought to you by:
stechio
PDF Clown v0.1.1.0.
Document:
PDF Version: v1.2 (Acrobat 3.x).
PDF Producer: Acrobat Distiller 5.0.2 for Macintosh.
When attempting to access this property:
pdfDoc.Metadata.Content
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.
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:
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: