Alternate Text for Document Graphics
The example below shows how to extract alternate text for a graphic in your source document, and include it as an Alt attribute for the graphic when the document is published as tagged PDF output. The alternate text will be extracted from a child element of the graphic tag, which contains the alternate text in the source document.
For example, graphics in your document are represented by the image element, which have a child element alt that contains the alternate text. The alt element is hidden from output. Follow these steps to output an Alt attribute in tagged PDF, whose value is the content of the original alt element.
Alternatives for configuring the alt attribute in HTML output are given in parentheses. Alternatively, you could select the Synchronize with HTML attribute option in the PDF Attribute dialog box, and Arbortext Styler will configure the equivalent alt attribute automatically.
1. Navigate to the Print/PDF tab of the Stylesheet Properties dialog box. Confirm that the Generate tagged PDF option is selected. Selecting this option will ensure you have access to the controls in the Tags category.
The option is only available when the stylesheet is set to publish print/PDF with the PTC ALD engine.
HTML: no need to carry out equivalent selection, alternate text can be included in regular or semantic HTML outputs.
2. Select the image element in the Elements list.
3. Navigate to the PDF tags category.
HTML: Navigate to the HTML tag category.
4. Note the PDF tag that is set for the image element, for example Figure
HTML: Note the HTML tag that is assigned, for example img.
5. In the Attributes field, click Add to open the PDF Attribute dialog box.
HTML: clicking the Add button will open the HTML Attribute dialog box.
6. From the PDF attribute drop down list, select Alt.
HTML: select alt from the HTML attribute list.
7. In the Value field, select the From XPath option.
8. In the From XPath field, enter the XPath expression that will extract the content of the child alt tag of the image element, i.e. child::alt.
9. Click OK to exit the dialog box. You will see that the attribute setting is listed in the Attributes table.
10. Publish tagged PDF, selecting the Tagged PDF option in the Publish to PDF File dialog box.
In the resulting tagged PDF output, you will see a Figure PDF tag output for every instance of an image element in your source document. Each one will have an /Alt attribute (Alternate Text) whose value is the value of the alt attribute on its source image element.
In HTML output, note the presence of img tags with alt attributes.