Search Results for

    Show / Hide Table of Contents

    Archiving - PDF/A

    Version 6.2.0 ยท 2024-08-12

    In this article

    • What is PDF/A?
    • Limitations
    • Create a PDF/A document
    • PDF/A validation

    This article describes how to create a PDF/A-conforming document.

    Note

    PDF/A support is under construction. The current implementation is in a very early state.

    What is PDF/A?

    PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for use in the archiving and long-term preservation of electronic documents. PDF/A differs from PDF by prohibiting features unsuitable for long-term archiving, such as font linking (as opposed to font embedding) and encryption.

    Limitations

    With PDFsharp you can create new documents that are PDF/A-conforming.

    • PDFsharp cannot convert an existing non-PDF/A document to a PDF/A-conforming one.
    • When you add a page or XObject from an external resource to your document, PDFsharp cannot ensure that this object is PDF/A-conforming.
    • PDFsharp cannot check whether an existing file is PDF/A-conforming.

    Create a PDF/A document

    To tell PDFsharp that a document should be PDF/A-conforming call the SetPdfA function. This is only a hack in this preview and may change in the future. You cannot set a specific PDF/A level.

    var document = new PdfDocument();
    document.SetPdfA();
    

    One requirement of PDF/A is the creation of a tagged PDF. This is currently already implemented with PDF/UA because accessibility is also based on tagged PDF. PDF/A and PDF/UA are different things, but at the current stage of implementation you must create an UAManager.

    // Get the manager for universal accessibility.
    var uaManager = UAManager.ForDocument(document);
    

    Use the StructureBuilder to tag text as e.g. an article with a paragraph. For more information see PDF/UA.

    var font = new XFont("Verdana", 10, XFontStyleEx.Regular);
    var pdfPage = document.AddPage();
    var xGraphics = XGraphics.FromPdfPage(pdfPage);
    
    // Get structure builder.
    var sb = uaManager.StructureBuilder;
    // Create article element in document.
    sb.BeginElement(PdfGroupingElementTag.Article);
    {
      // Create paragraph element.
      sb.BeginElement(PdfBlockLevelElementTag.Paragraph);
      var layoutRectangle = new XRect(0, 72, pdfPage.Width.Point, pdfPage.Height.Point);
      sb.End();
    }
    sb.End();
    

    PDF/A validation

    For validation if a PDF document is PDF/A-conforming, we use veraPDF. veraPDF is an Open-Source tool developed by the PDF Association to analyze PDF documents and get detailed information about its PDF/A conformity. It can also be used for PDF/UA validation.

    • Edit this page
    In this article
    Generated by DocFX  |   Privacy policy  |   Legal notice
    Back to top