Accessible PDF Document Creation | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Accessible PDF Document Creation

A PDF file without accessible information is of no use to the people who need a screen reader and text-to-speech tool. Therefore, a need for creating accessible PDF files (usually referred to as a tagged PDFs) arises. The tagged PDF is a PDF file that includes structure in terms of tags that defines reading order and the meaning of significant elements such as figures, images, lists, tables, etc.

PDF tags provide a hidden-structured, textual representation of the PDF content that is presented to the screen readers. They exist only for accessibility purposes and have no visible effect on the PDF file. In the PDF file, it is not guaranteed that the content displaying order is the same as the physical order of objects within the PDF’s content stream. Some of the screen readers may use physical order to read-aloud the content. Here, the tags will help the screen reader to provide the correct reading order and experience to people with disabilities.

The Essential PDF library provides the ability to create accessible PDF files from the version 15.3.0.26 onwards via the tagged PDF feature. PDF documents created using the Essential PDF library are compliant with section 508 (PDF/UA). Essential PDF supports adding tags to PDF elements such as text, image, shapes, form fields, annotations, hyperlinks, tables, lists, etc.

Also, it supports the automatic addition of respective tags for each element, if the AutoTag property of PdfDocument class is set to true. But it will not add alternative text or descriptions for figures, images, and other properties related to the tag.

Say goodbye to tedious PDF tasks and hello to effortless document processing with Syncfusion's PDF Library.

To pass the full check of accessibility, you should follow the below conventions while tagging the PDF document:

  • Specify the Title of the PDF document in document properties.
  • Make sure that the images in the document either have alternate text or are marked as artifacts.
  • Bookmarks need to be included for tagged PDFs with more than 21 pages.
  • All the form fields require text description (tooltip).
  • All tables in a document should have a header.
  • Tables must contain same number of columns in each row.
  • A list element must contain a list item element (LI) and the list item element can contain only label (Lbl) or body elements (LBody).

The below code snippet is used to create a simple tagged PDF. A runnable sample can be downloaded from this link.

///Create a  new PDF document instance.  
PdfDocument doc = new PdfDocument();  

//Set the  document title in document properties.  
doc.DocumentInformation.Title  = "Tagged PDF";
  
//Enables the  automatic adding of respective PDF tags for each element.  
doc.AutoTag =  true;
  
//Add a new  PDF page.
PdfPage page = doc.Pages.Add();

//Create PDF  True Type font instance.
PdfTrueTypeFont tFont16 = new PdfTrueTypeFont(new System.Drawing.Font("Calibri", 16), true);
PdfTrueTypeFont tFont11 = new PdfTrueTypeFont(new System.Drawing.Font("Calibri", 11), FontStyle.Regular, 11, true, true);

//Create new  PDF solid brush.
PdfBrush headerBrush = new PdfSolidBrush(Color.Blue);

//Create PDF  layout format.
PdfLayoutFormat format = new PdfLayoutFormat();  
format.Layout  = PdfLayoutType.Paginate;

//Initialize  the structure element with tag type Heading level.
PdfStructureElement headingTag = new PdfStructureElement(PdfTagType.HeadingLevel1);


//Create a  header text.
PdfTextElement element = new PdfTextElement("Chapter
  1 – Text & Image",
  tFont16);
  
//Setting  heading level to differentiate it from paragraphs. By default, all the  textual contents are tagged as paragraphs.  
element.PdfTag  = headingTag;

//Create a  solid brush.
element.Brush  = headerBrush;

//Draw the  text element.
PdfLayoutResult result = element.Draw(page, PointF.Empty,  format);
PdfTextElement element1 = new PdfTextElement("Lorem
  ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
  nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
  eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
  sunt in culpa qui officia deserunt mollit anim id est laborum.", tFont11);  
result =  element1.Draw(result.Page, new RectangleF(new PointF(0, result.Bounds.Bottom + 10), result.Page.GetClientSize()),  format);
  
//Create a new PDF Bitmap.
PdfBitmap image = new PdfBitmap("../../adv.jpg");

//Set the tag  type for image.
PdfStructureElement imageElement = new PdfStructureElement(PdfTagType.Figure);
  
//Set the  alternate text.
imageElement.AlternateText  = "Adventure cycle";

//Adding tag  to the PDF image.
image.PdfTag  = imageElement;
result =
  image.Draw(result.Page, new RectangleF(0, result.Bounds.Bottom + 10,
  result.Page.GetClientSize().Width, (result.Page.GetClientSize().Height -
  result.Bounds.Bottom + 10)), format);

//Save the  PDF document.
doc.Save("output.pdf");
  
//Close the  PDF document.
doc.Close(true);

If you are new to our PDF library, it is highly recommended to go through the getting started section. For information on how to create a tagged PDF, please refer to this link.

Syncfusion’s high-performance PDF Library allows you to create PDF documents from scratch without Adobe dependencies.

Soon, the ability to modify the tab order in an existing tagged PDF document and the ability to create a tagged PDF while converting Word, Excel, and PowerPoint files to PDF files will be supported.

If you have any questions or require clarification about this support, please let us know in the comments below. You can also contact us through our support forum or Direct Trac. We are happy to assist you!

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed