Keith Harrison
Keith Harrison

Reputation: 31

PDF Accessibility | 'Title - Failed' Error in Acrobat Pro in PDF generated using XSL-FO

I'm creating a PDF file from XML using Apache FO. When I run an accessibility check on the generated PDF using Acrobat Reader Pro DC (version 2019.010.20098) the accessibility report indicates 'Title - Failed'.

When I look at the document's metadata in Acrobat (File --> Properties --> Description tab) I can see that the Title, Author and Subject values are all populated with the values defined in my FO stylesheet (see below).

If I go to File --> Properties --> Initial View (tab) --> "Window Options" (section) and select 'Document Title' in Show and then re-run the accessibility check the title passes.

This issue is identical to the one raised in this previous question.

Per an answer to the previous question, this issue was supposedly resolved in FOP 2.2. However, I've tried this using FOP 2.2 as well as FOP 2.3 and the issue still exists for me. I'm currently running FOP 2.3 which as of this writing is the current release.

Is there some FOP value or property that I need to set to cause Acrobat to default to displaying the Document Title rather than the File Name in the initial view?

Here's the relevant snippet of my XSL:

            ...
            </fo:layout-master-set>

            <fo:declarations>
                <x:xmpmeta xmlns:x="adobe:ns:meta/">
                    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                        <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
                            <dc:title>DOCUMENT TITLE</dc:title>
                            <dc:creator>COMPANY NAME</dc:creator>
                            <dc:description>DOCUMENT DESCRIPTION</dc:description>
                        </rdf:Description>
                    </rdf:RDF>
                </x:xmpmeta>
            </fo:declarations>

            <fo:bookmark-tree>
            ...

What am I missing?

Upvotes: 1

Views: 681

Answers (1)

Keith Harrison
Keith Harrison

Reputation: 31

I resolved this issue by adding the following snippet to my "fo:declaration" section:

            <fo:declarations>
                <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
                    <!-- this will replace the window title from filename to below dc:title -->
                    <pdf:dictionary type="normal" key="ViewerPreferences">
                        <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
                    </pdf:dictionary>
                </pdf:catalog>
                <x:xmpmeta xmlns:x="adobe:ns:meta/">

I learned about this approach in this question.

Thanks, @TonyGraham, for the assistance.

Upvotes: 2

Related Questions