We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Tagging html images with alternativetext

Is there a way to add Alternative Text to an image after converting to an auto tagged pdf from an html string? The html for my image has alt text but that doesn't seem to carry over so I was wondering if there's a way to do it after the ConvertToTaggedPDF step, by searching the img id/class/src or something like that. Or if there's some alteration I need to make to the html string to make the autotagger read the alt text as alternative text.

            string bufferString = docHelper.Get_HTML_For_TaggedDocument(print);
            PdfDocument doc = new PdfDocument();

            string baseUrl = "";
            doc.DocumentInformation.Title = document.Name;
            doc.AutoTag = true;
            //using (HtmlConverter html = new HtmlConverter())

            Thread t = new Thread(() =>
                HtmlConverter html = new HtmlConverter();
                    //Enable JavaScript

                html.EnableJavaScript = true;
                html.ConvertToTaggedPDF(doc, bufferString, baseUrl);
               //Tag images with alt text???
                doc.Save("c:\\temp\\htmlfiles\\" + fileName);


The AlternativeText reference was here: https://help.syncfusion.com/file-formats/pdf/working-with-tagged-pdf#adding-tag-to-image but I didn't find anything on adding it in other ways.

1 Reply

GK Gowthamraj Kumar Syncfusion Team September 16, 2019 11:38 AM UTC

Hi Atari, 

Thank you for using Syncfusion products. 

IE rendering engine make use of MSHTML (IE rendering engine) to convert HTML to vector images. From the images, we will render the PDF document. The alternate text information is not added in meta file, so we could not extract the alternative text details of the image inside the meta file. IE rendering engine does not supports adding alternate text for images inside the HTML string. Also, currently we do not have support for adding alternate in the converted/existing PDF documents. 

Please let us know if you need any further assistance on this.  

Gowthamraj K 

Live Chat Icon For mobile
Up arrow icon