Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to get information about the PDF/A format
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,103
Thanks: 7 times Was thanked: 128 time(s) in 125 post(s)
|
Question:I'm using the PDF viewer and would like to know how can I get information about the PDF/A or PDF/X Standard which are set in the document? I don't want to make validation checks about the PDF/A or PDF/X conformance. I only want to show the user if a PDF is produced as PDF/A and if so must be opened in readonly mode and can not be modified by the user. Thanks Answer:For valid PDF/A (1,2,3) formats, it is necessary to have the PDF/A Identifier in the document metadata. You can get access to these metadata using the code below: Code:
using (var doc = PdfDocument.Load(@"d:\0\format_PDF_A.pdf"))
{
if (doc.Root.ContainsKey("Metadata"))
{
var metadata = doc.Root["Metadata"].As<PdfTypeStream>();
string decodedText = metadata.DecodedText;
}
}
Metadata would be placed to decodedText varibale. You may try to load decoded text as XML using standard .Net XML reader to examine it using XML parser or just search for appropriate substring. The metadata must contain the corresponding «pdfaid:part». For PDF/A-1, this is <pdfaid:part>1</pdfaid:part>, for PDF/A-2 <pdfaid:part>2</pdfaid:part>, for PDF/A-3 <pdfaid:part>3</pdfaid:part>For example, in the metadata from the test document, this line is located at the last rdf:Description section of the below xml: Code:
<?xml version="1.0"?>
<?xpacket begin="???" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<?xpacket end="w"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
<dc:format>application/pdf</dc:format>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<pdf:Producer>Adobe PDF Library 10.0; modified using iTextSharp 4.1.6 by 1T3XT</pdf:Producer>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate>2016-10-25T15:06:00+02:00</xmp:CreateDate>
<xmp:ModifyDate>2016-10-25T15:06:00+02:00</xmp:ModifyDate>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
--here--> <pdfaid:part>1</pdfaid:part>
<pdfaid:conformance>B</pdfaid:conformance>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
Edited by user Friday, April 6, 2018 5:37:06 AM(UTC)
| Reason: Not specified
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to get information about the PDF/A format
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close