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.

2015-04-21

How to export document to PDF/A and its core differences from PDF

Introduction


PDF/A is a format based on PDF and designed for long-term data archiving.  The profound description of this standard can be found on Wikipedia or in ISO 19005-1, ISO 19005-2, ISO 19005-3 documents. We won’t dive into all specifics here and will limit ourselves to a brief description of its core differences.

The main requirement a PDF/A document should conform to is a self-containment. That is, all the data required to display this document should be embedded, including:

  • Fonts, including standard 14 PDF fonts, preferably in a form of font subsets if not all glyphs are used
  • Output intent colorspace in a form of ICC profile
  • Images, if image colorspace is different from the output intent then conversion is required
  • Forms fields appearance

Many features allowed in PDF are prohibited in PDF/A, for example:

  • Soft masks and transparency groups
  • Some types of annotations
  • Links to external docs
  • Embedded files
A conformance of a document to PDF/A standard can be validated using many tools, and an “official” one is a Pre-flight, available in Adobe Acrobat Pro. Apitron PDF Kit for .NET supports export to PDF/A on a core level and can be used to create PDF files for archiving and platform-independent viewing. See the code samples provided in The code section.

The code


Let’s create the simple “Hello World!” PDF/A document using Apitron PDF Kit for .NET and check its properties. Functions below demonstrate how to do it using both supported APIs.

Fixed layout API:

/// <summary>
/// Creates PDF/A document using Fixed layout API.
/// </summary>
private void CreatePDFADocumentUsingFixedLayoutAPI()
{
    // create document object and indicate PDF/A support
    FixedDocument doc = new FixedDocument(PdfStandard.PDFA);
           
    // create text object, set its font and content
    TextObject textObject = new TextObject(StandardFonts.Helvetica,14);
    textObject.AppendText("Hello world! PDF/A document created by Apitron PDF Kit for .NET.");

    // create new page and append text object created above
    Page page = new Page(Boundaries.A4);
    page.Content.Translate(10,820);
    page.Content.AppendText(textObject);
    doc.Pages.Add(page);

    // save PDF/A document
    using (Stream stream = File.Create("pdfa_doc.pdf"))
    {       
        doc.Save(stream);
    }
}


Flow layout API:

/// <summary>
/// Creates PDF/A document using Flow layout API.
/// </summary>
private void CreatePDFADocumentUsingFlowLayoutAPI()
{           
    ResourceManager resourceManager = new ResourceManager();           
    // create document and set margin
    FlowDocument doc = new FlowDocument(){Margin = new Thickness(10)};           

    // create text block and append to document
    TextBlock textBlock = new TextBlock("Hello world! PDF/A document created by Apitron PDF Kit for .NET.");
    doc.Add(textBlock);

    // save as PDF/A document
    using (Stream stream = File.Create("pdfa_doc.pdf"))
    {
        doc.Write(stream, resourceManager, new PageBoundary(Boundaries.A4), PdfStandard.PDFA);
    }
}

Functions above produce identical PDF files looking as one shown below:


Pic. 1 PDF/A document produced by Apitron PDF Kit

On the left panel you can see that produced document successfully passes PDF/A standard conformance validation.

Conclusion


Apitron PDF Kit for .NET library is available by the following link. It can be used to create cross platform PDF processing applications and is suitable for many PDF generation scenarios.  Create Windows, Android and iOS (Xamarin), MONO apps, web or cloud solutions. It’s truly cross-platform and we constantly improve it by adding new features and providing updates.

Check out our free book describing the API and containing ready to use code snippets. Read our blog or contact us if you have any questions.

Downloadable version of this article can be found by the following link [PDF].

No comments:

Post a Comment