Dear Wiki user, You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" for change notification.
The following page has been changed by JostKlopfstein: http://wiki.apache.org/xmlgraphics-fop/PDF_Accessibility New page: ##language:en #pragma section-numbers off This page contains notes on the initial PDF accessibility implementation in Apache FOP. == Introduction == === PDF accessibility / Tagged PDF links === * [http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf PDF Reference 1.4, chapter 9.7 Tagged PDF, chapter 9.8 Accessibility Support] * [http://en.wikipedia.org/wiki/Portable_Document_Format#Accessibility Wikipedia] * [http://www.section508.gov Section 508 Standards] === Testing PDF accessibility (Tagged PDF's) === * Acrobat Professional - Accessibility Check creates a report indicating any deficiencies with a PDF document. * Screen Readers can read tagged PDF's, see [http://en.wikipedia.org/wiki/Portable_Document_Format#Accessibility Wikipedia] == Common requirement for tagged PDF's and PDF Accessibility == '''(R1)''' The documents logical structure has to be included into the PDF file (see PDF Reference 1.4 section 9.7). == Additional requirements for accessible PDF's == Screen readers require additional information in tagged PDF files in order to read documents aloud. To enable proper vocalization PDF supports the following features: '''(R2)''' Providing textual descriptions for images (see PDF Reference 1.4 section 9.8.2, "Alternate Descriptions") '''(R3)''' Specifying the natural language used for text in a PDF document - for example, as English or German (see PDF Reference 1.4 section 9.8.1, "Natural Language Specification"). An accessible PDF document should include the document's default language which applies to all text in a PDF document. You can change a language on descendant elements by overriding the document's language. The section [#head-1aae9f58ba7b221421d56567b1b6a50d9a75792c Changes to your XSL-FO input files] will illustrate where you provide this information in the input XSL-FO file. == Implementation == The challenge is to find the corresponding FO of a text element or image that is sent to the PDFPainter.drawText respectively PDFPainter.drawImage from the LM's. This is required to build the structure tree. The current implementation uses 2 XSLT transforms as a preprocess in Fop.getDefaultHandler. The first {{{addPtr.xsl}}} adds a pointer attribute with an unique value to each FO that appears in the structure tree. The second transform {{{reduceFOTree.xsl}}} removes all elements, attributes and text from the input FO, that are not required in the structure tree. The result from this second transform can be seen in the new IF, where it is split per page-sequence. See the element {{{structure-tree}}} below: {{{ <?xml version="1.0" encoding="UTF-8"?> <document xmlns="http://xmlgraphics.apache.org/fop/intermediate" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation"> <header> <x:xmpmeta xmlns:x="adobe:ns:meta/"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="> <xmp:CreateDate>2009-01-20T22:27:23-08:00</xmp:CreateDate> <xmp:CreatorTool>Apache FOP Version SVN branches/Temp_AreaTreeNewDesign</xmp:CreatorTool> <xmp:MetadataDate>2009-01-20T22:27:23-08:00</xmp:MetadataDate> </rdf:Description> </rdf:RDF> </x:xmpmeta> </header> <page-sequence> <structure-tree> <fo:flow xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:block xmlns:foi="http://xmlgraphics.apache.org/fop/internal" foi:ptr="N10014"/> </fo:flow> </structure-tree> <page index="0" name="1" page-master-name="1" width="594720" height="792000"> <page-header/> <content> <viewport width="594720" height="792000"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266" ptr="N10014">hello</text> </viewport> </content> <page-trailer/> </page> </page-sequence> <trailer/> </document> }}} The pointer information is also passed to the PDFPainter.drawText and PDFPainter.drawImage method. You can find the pointer attributes in the above IF in the {{{page}}} element in the elements {{{text}}} and {{{image}}}. == User Guide == === Enabling PDF accessibility === There are 3 ways to enable PDF accessibility: * '''Command line''' The command line option -a turns on accessibility. {{{fop -a -fo testcases/tc1/tc1.fo -pdf testcases/tc1/tc1.pdf}}} * '''Embedding''' {{{userAgent.getRendererOptions().put("accessibility", Boolean.TRUE);}}} * '''Optional setting in fop.xconf file''' {{{ <fop version="1.0"> <accessibility>true</accessibility> ... </fop> }}} Make sure to call the new PDF code when you embed FOP in your Java code: {{{MimeConstants.MIME_PDF + ";mode=painter"}}} === Changes to your XSL-FO input files === * '''(R1)''' Table cells require a table row as the parent. * '''(R1)''' Ensure that the order of {{{fo:block-container}}} in a page corresponds to the reading order. * '''(R2)''' Alternate text for images: The attribute {{{fox:alt-text}}} has been added for {{{fo:external-graphic}}} and {{{fo:instream-foreign-object}}}. * '''(R3)''' Document's default language: ''The document's default language is currently hard coded to English.'' === Note === Adjust the Java heap size in order to process larger files. == TODO == '''(R3)''' Decide how the language should be defined. Other implementations specify the @xml:lang on fo:root level. The same attribute is set for descendant's to override the default language. There is also the common FO property {{{country}}} and {{{language}}} to consider. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
