Office File API & Office-Inspired Desktop UI Controls - Generate Accessible PDF Files (v21.2)

Office-Inspired Products
22 November 2021

Our most recent release (v21.2) includes enhanced PDF export options for our Spreadsheet and Word Processing product lines (WinForms-WPF-Office File API). You can now convert your spreadsheet and rich text documents to accessible PDF files. This will allow people with disabilities to use screen readers and other assistive technologies to read and navigate PDF documents.

Supported Accessible PDF File Formats

With the DevExpress Office File API and our Office-inspired WinForms and WPF UI components, you can generate PDF files that conform to the following standards:

  • PDF/A Conformance Level A (Accessible): PDF/A-1a, PDF/A-2a, PDF/A-3a

    PDF/A is an archival PDF format used for long-term preservation of electronic documents. Conformance level A includes requirements designed to preserve a document’s logical structure, semantic content, and natural reading order. This conformance level helps produce accessible documents for people with disabilities (for example, visually impaired individuals).

  • PDF/UA (Universal Accessibility)

    This standard applies specific demands on the semantic structure of PDF documents to help ensure accessibility and support for assistive technologies. The requirements outlined in the PDF/UA spec are based on Web Content Accessibility Guidelines (WCAG) 2.0.

When you save a text document or workbook in one of the formats described above, the DevExpress PDF export engine creates tags for all meaningful document elements (headings, paragraphs, tables, lists, images, etc.). These tags are organized into a hierarchical tree – a tree that defines the order in which a screen reader recites document content.

How to Generate an Accessible PDF File

Use the following PdfExportOptions class properties to specify the desired accessibility standard (exported PDF files will conform to one of these standards):

Pass a PdfExportOptions class instance to the ExportToPdf method of the appropriate DevExpress component (Spreadsheet/Rich Text Control for WinForms/WPF or Office File API) to export a workbook or text document to PDF.

Example 1. Use the Spreadsheet Document API to Save an Excel Workbook as a PDF/UA File

using DevExpress.Spreadsheet;
using DevExpress.XtraPrinting;
// ...

using (var workbook = new Workbook())
{
    // Load XLSX document. 
    workbook.LoadDocument("Document.xlsx", DocumentFormat.Xlsx);
    
    // Specify PDF export options.
    var options = new PdfExportOptions();
    options.PdfUACompatibility = PdfUACompatibility.PdfUA1;

    // Save workbook as PDF/UA file.
    workbook.ExportToPdf("OutputDocument.pdf", options);
}

Example 2. Use the Word Processing Document API to Save a Word Document as a PDF/UA File

using DevExpress.XtraRichEdit;
using System.Drawing;
// ...

using (var wordProcessor = new RichEditDocumentServer())
{
    // Load DOCX document.
    wordProcessor.LoadDocument("Document.docx", DocumentFormat.OpenXml);
    
    // Specify PDF export options.
    var options = new PdfExportOptions();
    options.PdfUACompatibility = PdfUACompatibility.PdfUA1;

    // Save document as PDF/UA file.
    wordProcessor.ExportToPdf("OutputDocument.pdf", options);
}

You can also save a text document or workbook as an accessible PDF file directly within our Rich Text Editor or Spreadsheet control’s Print Preview window.

Try It Now

To explore PDF accessibility features in greater detail, be sure to check out our new Office File API demo modules:

Once you generate a PDF file, you can use Adobe Acrobat Pro DC or PDF Accessibility Checker (PAC) to check adherence to accessibility standards. The following image displays verification results for our sample document saved as a PDF/UA file (we used Acrobat Pro DC to verify adherence):

Your Feedback Matters

We’d love to know what you think of PDF accessibility support within our Office-inspired products. Please share your thoughts in the comment section below or submit a support ticket via the DevExpress Support Center.

FREE DevExpress Xamarin UI Controls

Deliver high-impact native mobile apps with our feature-rich Data Grid, Scheduler, Chart, TabView, Editors, and utility controls. Reserve your free copy today!
CRM-49a54daa-6c16-4310-9f10-0ce9c7ea3f22
Lakra4k
Very good!
23 November 2021

Please login or register to post comments.