We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create Accessible PDF files/Tagged PDFs/ADA compliant PDFs using Aspose.PDF for .NET

Hi,

in WCAG Accessibility you mentioned that ASPOSE can manipulate ALT attributes, defineing language and other accessiblity features.

can you please direct me to the suitable code example?
Does Aspose supports tagged document?
What kind of accssibility features ASPOSE supports?

Thank you,

@yaronz

Thanks for contacting support.

We are checking details at our side, regarding your requirements and will get back to you shortly. Please be patient.

@yaronz

Thanks for your patience.

You may please use following code snippet, in order to edit a tagged PDF.

string value = "555";
Document doc = new Document(inFile);
Element root = doc.LogicalStructure;
TextElement el = root.Children[0] as TextElement;
el.ActualText = value;
doc.Save(outFile);
doc = new Document(outFile);
root = doc.LogicalStructure;
el = root.Children[0] as TextElement;
Assert.AreEqual(value, el.ActualText); 

Please note that as tagged PDF documents have been obsoleted, so we strongly recommend to use PDF/A-1A for conversion. Please check following code snippet for mentioned conversion.

Aspose.Pdf.Document pdf1 = new Aspose.Pdf.Document(inFile);
pdf1.Convert(new MemoryStream(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
pdf1.Save(dataDir + "CreatePdfA1_out.pdf");

We have already logged a feature request to support generation of WCAG 2.0 compliant PDF documents, as PDFNET-39050 in our issue tracking system. I have associated the logged ticket ID with this forum thread as well, so that you will receive notification once the feature is available. As soon as we have some news on its availability, we will inform you. Please be patient and spare us little time.

We are sorry for the inconvenience.

Hi asad.ali
I tried to use the sample you descrived (With aspose total lic)
But unfortunately not only Aspose is not keeping the TAGS it also delete them.

If I open pdf in Acrobat Reader its marked as “Tagged PDF : No” at the document properties.
What I’m missing? Is that how aspose works? Is there a different way to keep the tags?

Thank you for your support.
Yaron,

@yaronz

Thanks for writing back.

Would you please share your sample PDF document along with the code snippet, so that we can observe the issue in our environment and address it accordingly.

Hi,
Thank you for your reply

PDF attached1-AfterSaveFromSystem-PDF_A_1A.pdf (415.0 KB)

This file is currently not tagged.

My Code sample

Document pdfDocument = null;
try
{
pdfFile = GetFile();
pdfDocument = new Document(pdfFile + “1-AfterTags.pdf”);
}
catch (Exception ex)
{
Console.WriteLine(“Can’t find pdf file”);
return;
}
pdfDocument.Convert(new MemoryStream(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
pdfDocument.Save(pdfFile + “1-AfterTags-PDF_A_1A.pdf”);

Thank you ,
Yaron

@yaronz

Thanks for contacting support.

Would you please share the respective input PDF document. So that we can test the scenario in our environment and log an investigation ticket, if necessary.

Sure 1.pdf (376.7 KB)
This one is marked as Tagged PDF.

Yaron,

@yaronz

Thanks for sharing the sample input PDF.

We have tested the scenario with Aspose.Pdf for .NET 17.11, as it is always recommended to use latest version of the API and output PDF was still showing Tagged property as “Yes” in the document properties dialog. For your reference, we have attached the generated PDFA file in our environment.

TaggedPDF_out.pdf (368.5 KB)

Furthermore, we have observed that the generated PDF/A-1a document, did not pass the compliance test in Adobe Preflight tool. So we have logged an issue as PDFNET-43658 in our issue tracking system. We will further look into the details of the issue and keep you updated with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.

Thank you
I will test it.

@yaronz

Please take your time to test the scenario at your end and in case of any issue, please feel free to let us know.

Hi,

I tried your advice and it worked, Thank you.

But there is a little thing
My licence is valid till 05 April 2017

And I notice at your Release Notes the following:
PDFNET-41810 PDF to PDF/A_1b - Text is garbled in resultant file

Is it the same for A_1a?
Does it means that my files can be grabled?
Do I must update my licence to get clean file?

Thank you,
Yaron

@yaronz

Thanks for your feedback.

Please note that sometimes issues are used to be document specific and have only been fixed for that specific document. The issue which you have mentioned, was reported for a particular document as well as for a particular PDF format (PDF/A-1b). Since each PDF document has its own structure and complexity level so it cannot be said that same issue will be experienced with every PDF document.

We recommend to use latest version always because each new version comes with new enhancements and more fixes. Moreover, fixes against the issues, reported for older version of the API, are provided in new releases. As far as you are not experiencing any issue with your existing version of the API, you may keep using it and in case you experience any issue, which does not occur with latest version of the API, you may please upgrade your license to get latest version.

In case of any further assistance, please feel free to let us know.

Thank you for your reply,

So, If I understand you currectly
there is no known issue about A_1a grabled, right? at least at this moment.

Yaron,

@yaronz

Yes, your understanding is correctly. There is no known issue of Text Grable during PDF to PDF/A-1a conversion. As I stated earlier that it can be document specific and in case you face similar issue with any of your PDFs, please share the document with us. We will test the scenario in our environment and address it accordingly.

Hello
I see that at the new aspose version (19.4) is supporting PDF/UA files, that is great.

Can you help with how to convert an accessible WORD document to a PDF/UA-1 file?
(keeping the tags)

Thank you,
Yaron

@yaronz

In order to generate PDF files from Word format, you need to use Aspose.Words API. In case you have accessible Word Document, you can convert it to PDF and share with us if you face any issue.

Hi
Thank you for your quick reply

I attached the Word document that I want to convert to PDF/UA format

I used the following code (aspose total version 19.4);

        Aspose.Words.Document wordDocument = null;
        string inputFile = "2.doc";
        string outputfile = "2PDF_UA.pdf";

        try
        {
            Aspose.Words.License license = new Aspose.Words.License();
            license.SetLicense("Aspose.Total.lic");

            wordDocument = new Aspose.Words.Document(inputFile);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Can’t find pdf file");
            Console.ReadKey();
            return;
        }

        wordDocument.Save(outputfile);


        Aspose.Pdf.Document pdfDocument = null;
        pdfDocument = new Aspose.Pdf.Document(outputfile);

        Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
        pdflicense.SetLicense("Aspose.Total.lic");

        pdfDocument.Validate("validate.xml", PdfFormat.PDF_UA_1);

        pdfDocument.Convert("file.log", PdfFormat.PDF_UA_1, ConvertErrorAction.Delete);
        pdfDocument.Save(outputfile);

        Console.ReadKey();

The main purpose is to see that the PDF document created is a Tagged PDF (PDF/UA and WCAG Compliance)

2.zip (19.8 KB)

(if you can share a code it will be the best :slight_smile: )

Thank you for your help
Yaron,

@yaronz

We are looking into the scenario and will get back to you shortly.

Hi,

Is there an answer for this issue?
we are using the 30 days licence and it about to over, I will not be able to test it again.

Thanks
Yaron