Alternative text for images in PDF header

Hello,

It seems that if I want to save a document as pdf, the alternative text from header’s image is lost. I don’t have any problems with .docx. Do you have a guideline for this or a workaround?

example:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
Shape imgObj = builder.InsertImage(img);
imgObj.AlternativeText = “blabla”;

Aspose.Words.Saving.PdfSaveOptions pdfOptions = new Aspose.Words.Saving.PdfSaveOptions()
{
PreserveFormFields = true,
ExportDocumentStructure = true,
Compliance = Aspose.Words.Saving.PdfCompliance.PdfA1a,
SaveFormat = Aspose.Words.SaveFormat.Pdf
};
doc.Save(pdfPath, pdfOptions);

Thanks!

@stelydapro

Please ZIP and attach the image that you are inserting into document along with problematic and expected output PDF files here for testing. We will investigate the issue and provide you more information on it.

Thank you for your quick answer.

I’ve attached the solution, image, .docx (alt text is there), and pdf.

https://www.dropbox.com/s/5h8inlb2yt369vd/repos.zip?dl=0

@stelydapro

If you export the same document with document structure elements using MS Word, the alternative text of image is not exported.

Please ZIP and attach your expected output PDF along with screenshot where you want to see the alternative text. Thanks for your cooperation.

I’m lost. Both documents were exported (created) with the small app from zip, using Aspose.Words.

@stelydapro

Please note that Aspose.Words mimics the behavior of MS Word. If you insert an image into Word document’ header, set its alternative text, and export it to PDF using MS Word, the alternative text is not exported into PDF. Please check the attached image and output PDF file generated by MS Word. Aspose.Words generates the same output.
ms word.pdf (177.8 KB)
Alternative text.png (119.1 KB)

In case your requirement is different, please ZIP and attach your expected output PDF along with screenshot of PDF file that shows the alternative text. We will then guide you according to your requirement.