HTML to PDF and keep accessibility in C#

I am converting an HTML document to a PDF document and I need to keep the accessibility tags for the generated PDF file. The input HTML document has valid accessibility that I confirm through file upload at Nu Html Checker

After the PDF document has been generated the document no longer has its accessibility features.
I have used the sample code from Aspose.

This is the exact code I have been using:
HtmlLoadOptions options = new HtmlLoadOptions();
var inputFilePass = Path.GetFullPath(@“…....\TestData\input_Pass.html”);
var output = Path.GetFullPath(@“…....\Output\output.PDF”);
Document pdfDocument = new Document(inputFilePass, options);

I would really appreciate if anyone knows if it is possible to keep the accessibility features of the document when the document is converted from HTML to PDF.


Can you attach the HTML sample in a zip file so I can check and pass it to the dev team if needed?

@carlos.molina (561 Bytes)


After research more the Accesbility features, they are all related to the creation of a PDF, but not loading it. Here is the documentation of how to create a tagged Pdf if that may help you.

Thank you for your reply. I just want to make sure I understand you fully. The provided code sample from Aspose on how to convert an HTML document to a PDF document does not support accessibility. But I would need to create the PDF document as described in the “Create Tagged PDF”, correct?


Sorry if I was not clear. So far when loading an Html document to convert to a PDF document, the content is not created as tagged automatically.

When creating a document from scratch you can tag the content of the document by following the documentation procedures.

In summary, the code sample in the documentation are not to convert an HTML to a PDF tagged, but to create a PDF from scratch with tagged content.

So at the moment Aspose.Pdf does not support accesibility(tagged content) when loading a document from an Html source.

But when creating a PDF manually it does(if you create it following the documention).

1 Like