<?xml version="1.0" encoding="ISO-8859-1"?><!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><!-- $Id: accessibility.xml 898840 2010-01-13 17:05:59Z vhennebert $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN" "document-v13.dtd">
<document>
  <header>
    <title>Accessibility</title>
  </header>
  <body>
    <section id="overview">
      <title>Overview</title>
      <p>
        This page describes the
        <link href="http://en.wikipedia.org/wiki/Accessibility">accessibility</link>
        features of Apache FOP.
        <link href="http://www.section508.gov/">Section 508</link> defines accessibility in the context
        of electronic documents for the USA but other countries have similar requirements.
      </p>
      <p>
        Accessibility features are available only for the PDF output format and there are some 
        implementation limitations. Also, certain actions must be undertaken by the content creator 
        to ensure that FOP can create a truly accessible document. 
      </p>
    </section>
    <section>
      <title>Enabling accessibility</title>
      <p>There are 3 ways to enable accessibility:</p>
      <ol>
        <li>
          <strong>Command line:</strong> The command line option -a turns on accessibility:
          <code>fop -a -fo mydocument.fo -pdf mydocument.pdf</code>            
        </li>
        <li>
          <strong>Embedding:</strong> <code>userAgent.setAccessibility(true);</code>
        </li>
        <li>
          <strong>Optional setting in fop.xconf file:</strong>
          <pre>
          &lt;fop version="1.0"&gt;
              &lt;accessibility&gt;true&lt;/accessibility&gt;
              ...
          &lt;/fop&gt;
          </pre>
        </li>
      </ol>
      <p>
        When accessibility is enabled, additional information relating to the logical structure of 
        the document is added to the PDF. That information allows the PDF viewer (or a 
        text-to-speech application) to retrieve the natural reading order of the document.
      </p>
      <note>The processing of the logical structure is memory-hungry. You may need to adjust the 
        Java heap size in order to process larger files.</note>
    </section>
    <section id="source">
      <title>Changes to your XSL-FO input files</title>
      <p>
        Apache FOP cannot automatically generate accessible PDFs. Some of the work can only be
        performed by the content provider. Following are some changes that may be necessary to
        your XSL-FO content in order to generate really accessible documents:
      </p>
      <ul>
        <li>Table cells must have a table row as their parent.</li>
        <li>
          Images must have an alternate text: use the <code>fox:alt-text</code> extension attribute 
          (in the <link href="extensions.html#fox-namespace">fox namespace</link>) on 
          <code>fo:external-graphic</code> and <code>fo:instream-foreign-object</code> to specify a 
          short text describing the image.
        </li>
        <li>
          Ensure that the order of <code>fo:block-container</code> elements in a page corresponds to
          the reading order.
        </li>
        <li>
          Specify the natural language of the document using the language and country properties
          (or via the <code>xml:lang</code> shorthand property).
        </li>
      </ul>
    </section>
    <section id="customTags">
      <title>Customized Tagging</title>
      <p>The <link href="#PDFReference">PDF Reference</link> defines a set of standard Structure Types to 
        tag content. For example, &#8216;P&#8217;  is used for identifying paragraphs, &#8216;H1&#8217; to &#8216;H6&#8217; for headers, 
        &#8216;L&#8217; for lists, &#8216;Div&#8217; for block-level groups of elements, etc. This standard set is aimed at 
        improving interoperability between applications producing or consuming PDF. </p>
      <p>FOP provides a default mapping of Formatting Objects to elements from that standard set. 
        For example, <code>fo:page-sequence</code> is mapped to &#8216;Part&#8217;, <code>fo:block</code> is 
        mapped to &#8216;P&#8217;, <code>fo:list-block</code> to &#8216;L&#8217;, etc.</p>
      <p>You may want to customize that mapping to improve the accuracy of the tagging or deal with 
        particular FO constructs. For example, you may want to make use of the &#8216;H1&#8217; to &#8216;H6&#8217; tags to 
        make the hierarchical structure of the document appear in the PDF. This is achieved by using 
        the <code>role</code> XSL-FO property:</p>
      <source xml:space="preserve"><![CDATA[...
<fo:block role="H1" font-weight="bold">I. A Level 1 Heading</fo:block>
<fo:block>This is the first paragraph of the first section...</fo:block>
...]]></source>
      <p>If a non-standard structure type is specified, FOP will issue a warning and fall back to 
        the default tag associated to the Formatting Object.</p>
    </section>
    <section id="testing">
      <title>Testing</title>
      <p>
        Accessible PDFs can be tested, for example, using Adobe Acrobat Professional. Its 
        Accessibility Check feature creates a report indicating any deficiencies with a PDF 
        document. Alternatively, you can just let a screen reader read the document aloud.
      </p>
    </section>
    <section id="limitations">
      <title>Limitations</title>
      <p>
        Accessibility support in Apache FOP is relatively new, so there are certain
        limitations. Please help us identify and close any gaps.
      </p>
      <ul>
        <li>
          The natural language can currently only be specified at the page-sequence level. The
          document language is derived from the language of the first page-sequence. It is
          currently not possible to override the language inside the content below the
          page-sequence level.
        </li>
        <li>
          It's currently not possible to specify the expanded form of an abbreviation or acronym.
        </li>
        <li>
          SVG graphics (or images in general) are treated as a single figure. Text contained in
          SVGs is not accessible. It's only possible to work with <code>fox:alt-text</code>.
        </li>
        <li>
          The side regions (region-before, region-after etc.) are currently not specially
          identified. Screen readers may read their content at page changes.
        </li>
      </ul>
    </section>
    <section id="links">
      <title>Related Links</title>
      <p>
        Many resources providing guidance about creating accessible documents can be found on the 
        web. Here are a few links, along with additional resources around the topic:
      </p>
      <ul>
        <li><link href="http://www.section508.gov/">US Government - Website on Section 508</link></li>
        <li><link href="http://en.wikipedia.org/wiki/Accessibility">Wikipedia on Accessibility in general</link></li>
        <li><link href="http://en.wikipedia.org/wiki/Portable_Document_Format#Accessibility">Wikipedia on Accessibility in PDF</link></li>
        <li id="PDFReference">
          <link href="http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf">PDF 
            Reference 1.4</link> (look up chapters 9.7 "Tagged PDF" and 9.8 "Accessibility Support")
        </li>
        <li><link href="pdfa.html">PDF/A support in Apache FOP</link></li>
        <li><link href="http://wiki.apache.org/xmlgraphics-fop/PDF_Accessibility">Developer-oriented details on the accessibility features (on the Wiki)</link></li>
      </ul>
    </section>
  </body>
</document>