pdf links

PDF Rendering
Convert PDF to Image (.NET)
Convert PDF to image on Android (Xamarin)
Convert PDF to image on iOS (Xamarin)
Convert PDF to image in Windows Store apps (.NET)
Convert PDF to image in Windows Phone apps (.NET)
PDF to image in Universal Windows Store apps (.NET)
Free PDF Viewer control for Windows Forms (.NET)
How to integrate PDF Viewer control in WPF app (.NET)
Creating WPF PDF Viewer supporting bookmarks (.NET)
Cross-platform PDF Viewer using GTK# (MONO)
Silverlight PDF viewer control (Silverlight 5)
Multithreaded PDF rendering (.NET)
Convert pdf to image in Silverlight app (C# sample)
How to set fallback fonts for PDF rendering (C#)
Avoiding the out-of-memory exception on rendering (C#)
PDF viewer single page application (WebAPI, AngularJS)
PDF viewer control for Windows 10 universal applications
Use custom ICC profile for CMYK to RGB conversion
PDF layers - separate images, text, annotations, graphics

PDF Forms Creation PDF Security
Conversion to PDF/A
Other topics
PDF Document Manipulation
PDF Content Generation
Fixed and Flow layout document API (.NET)
Creation of grids and tables in PDF (C# sample)
How to create interactive documents using Actions (C# sample)
Text flow effects in PDF (C# sample)
How to generate ordered and bulleted lists in PDF (C# sample)
Convert HTML to PDF using flow layout API (C# sample)
How to use custom fonts for PDF generation (.NET)
Create document with differently sized pages (C#)
Create PDF documents using MONO (C#/MONO/Windows/OSX)
How to use background images for content elements (C#/PDF Kit/FlowLayout)
Add transparent images to PDF document (C#)
Draw round rect borders in PDF documents(C#)
ICC color profiles and and ICC based colors in PDF (C#)
How to use bidirectional and right to left text in PDF (C#)
Create PDF documents from XML templates (C# sample)
How to resize PDF pages and use custom stamps (C#)
Add header and footer to PDF page (.NET sample)
How to use clipping mask for drawing on PDF page
Fill graphics path with gradient brushes in PDF (Shadings)
Apitron PDF Kit and Rasterizer engine settings
Add layers to PDF page (optional content, C# sample)
How to create free text annotation with custom appearance

PDF Content Extraction
PDF Navigation

PDF to TIFF conversion
Contact us if you have a PDF related question and we'll cover it in our blog.

2016-02-13

PDFA validation - overcoming limitations of validation tools

Introduction


PDF/A is a perfect alternative when it comes to archiving and saving documents for later use. The format guarantees that the document can be read years after creation because all resources needed to process the document are embedded into the file. Sometimes PDFA is set as a requirement for saving documents with digital signatures, e.g. contracts, official papers and so on.

There are plenty of tools on the market that claim that they can produce PDF/A documents, and the only way to check if the tool fulfills this condition is to check it using a PDFA validation tool.

The most popular and reliable tool from our point of view is Adobe Acrobat Professional – a paid professional version of the well-known Adobe Reader. It allows you to validate the document against many conditions including PDF/A compatibility using built-in Preflight tool. As Adobe is the author of PDF standard it know all inside outs of the PDF/A as well.

There are other PDFA validation tools produced by various software companies, but sometimes their results differ from Adobe Acrobat Professional due to double interpretation of the PDF-A specification.

We use Adobe as a gold standard and Apitron PDF Kit for .NET product produces files 100% verifiable by Adobe Acrobat Professional. If you use the same toolchain you don’t have to worry, as this post describes possible warnings produced by other tools, and custom settings needed to avoid them.  

One of the possible warnings issued is – “the file contains cross reference streams”, it’s related to internal storage format of objects to ids mapping in PDF document. PDF versions prior to 1.5 (released in 2003) used cross reference tables instead of cross reference stream objects. The advantages of using streams over table are:

    • A more compact representation of cross-reference information

    • The ability to access compressed objects that are stored in object streams (see 7.5.7, "Object
    Streams" section of the specification) and to allow new cross-reference entry types to be added in
    the future

Current PDF version is 1.7 (updated 2011), so it’s a pretty old feature and PDFA (released in 2005) don’t forbid the use of such objects. To fix the cross-reference stream warning for those who need this we introduced the new setting for the PDF export API. The code sample can be found in the next section.


The code


class Program
{
    static void Main(string[] args)
    {
        using (Stream stream = File.Open(@"../../data/document.pdf",
            FileMode.Open, FileAccess.Read))
        {
            // create document object and specify the output format
            FixedDocument doc = new FixedDocument(stream, PdfStandard.PDFA);

            // save document
            using (Stream outputStream = File.Create(@"pdfa_document.pdf"))
            {
                // turn off cross reference stream usage
                doc.IsCompressedStructure = false;
                doc.Save(outputStream);
            }
        }
 
 Process.Start("pdfa_document.pdf");
    }
}

You see that by setting the IsCompressesStructure property it’s not possible to control cross reference streams usage. The complete code sample can be found in our github repo.

The image below demonstrates PDFA document validation using Adobe Acrobat:

Pic. 1 PDFA validation

Pic. 1 PDFA validation

Summary


The Apitron PDF Kit for .NET is a powerful library for creation and manipulation of PDF and PDF/A documents. This product has many unique features, offers easy to use API and is cross-platform that means you can create apps for .net (windows, windows phone, windows store), ios & android (via xamarin) and mono targeting modern mobile, desktop and web platforms at once. Contact us and we’ll be happy to answer your questions.

No comments:

Post a Comment