Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
Paul Rayman  
#1 Posted : Friday, April 6, 2018 5:33:27 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 936

Thanks: 3 times
Was thanked: 112 time(s) in 109 post(s)
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.


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:

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:

<?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="">
        <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:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
        <rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
--here-->   <pdfaid:part>1</pdfaid:part>

Edited by user Friday, April 6, 2018 5:37:06 AM(UTC)  | Reason: Not specified

Users browsing this topic
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.