Skip to content

Instantly share code, notes, and snippets.

@wklchris
Last active March 21, 2022 06:03
Show Gist options
  • Save wklchris/2c24a73fd8d6ebce5797284fdb7f1153 to your computer and use it in GitHub Desktop.
Save wklchris/2c24a73fd8d6ebce5797284fdb7f1153 to your computer and use it in GitHub Desktop.
PDF Accessibility Check

Accessibility check PDF guide

wklchris, last updated in Mar 2022

Table of Contents:

How to do an accessibility check?

  1. Open the PDF with Adobe Acrobat PRO. There is also other tools (e.g. free tool PAC can check but not correct accessibility). Here I focus on the Acrobat context.
  2. On the right panel, choose "Accessibility". If there is not such a button, click into "More tools" to find it.
  3. Then, click on the "Full check" to conduct an accessibility check for the PDF.

How to avoid accessibilty mistakes before creating the PDF? Any LaTeX packages?

There is a package called accessibility, but it seems to conflict with package lineno. I have also tested:

  • axessibilty: It has even more flaws, even can cause a PDF in incorrect structure and hard to fix tags.
  • accsupp: Its \BeginAcc... command doesn't work as expected.
  • pdfcomment: Its \pdftooltip command does the tooltip job, but still not equal to the alternative text.
  • tagpdf: Simply doesn't work.

Some suggestions:

  • Package hyperref provides many useful options, like pdftitle={Article Title} and pdflang={en-US}, can reduce the work you need to manually do after the compilation.
    • The pdftitle seems to fail to pass the check after an accessibility rule update. But using it can let you easily fix the title failure with the "Fix" in its right click menu.
  • Correctly use \toprule, \midrule and \bottomrule of the booktabs package. It helps you avoid table head failure.
  • Try to include vector images and set their background as transparent (INSTEAD OF white!). This is alway good for high contrast viewing mode.

Solutions to common PDF accessibility failures

In the followign description, we use Acrobat Pro DC by default.

Document: Bookmarks - Failed

This is caused by lack of bookmarks (Table of Contents). Sometimes Word converted PDF will lead to this error.

  1. Right click on the error, choose "Fix".
  2. Select the heading levels you want to included as TOC. For example, H2 and H3.
  3. Open the left panel bookmarks to check if the TOC shows appropriately. Sometimes you need to drag lower-level marks under higher-level ones to re-organize the nesting structure.

Document: Logical Reading Order (Need manual check)

I suggest check reading order in the LAST step, in case other accessibility fix changes the objects.

  1. Click on the "Reading Order" on the right accessibility check panel.
  2. In the poped up window, click on "Show Order Panel".
  3. Scroll on the PDF to see if objects in each pages follow the normal reading order.
    • If not, click & drag the item in the order panel to change the order.
    • If there are empty items (usually empty <p>s), you can right click on it in the panel and delete it.

Page Content: Tagged annotations - Failed

This is caused by unsupported or mistreated hyperlinks. If you use a comlicated and nested LaTeX syntax in a page, the pagenumber hyperlink may fail.

  1. Select the "Item 1" (or "Link", etc.) under the "Tagged annotations - Failed".
  2. Right click it to visit the content panel.
  3. You will see one or more "Link" under an "Annotations". Right click on one "Link" and choose "Find ..." to open a pop-up box.
  4. In the "Find" dropdown menu, select "Unmarked annotations". And select "Search Document" to avoid latter repeats.
  5. When "Find Next" finds one, click on "Tag element" and give it a "Link" type. You can leave its title blank.
    • If none can be found, I suggest you the use the link editing tool. On the right panel, use "Edit", and select "Add/Edit links" from the "Link" dropmenu on the Edit toolbar. Move your cursor to select the link and press delete key to delete it.
  6. Find next, until all annotations are taged.
  7. Back to the left panel, switch to the accessibility checker one, right click on the error and "Check Again".

Warning: This may cause an incorrect logical order. Please check the bottom items in the tag panel; if they are not belong to the last page, you may consider move them to the correct place.

Alternate Text

  • Figures alternate text - failed: Right click on the error and choose Fix. Then enter the alternate text needed.
    • Sometimes a figure is detected as multiple ones. We only need to go to tag list, drag the Path children (using Ctrl to multiselect them) under other Figure's to the main Figure object. Then delete the remaining empty Figure tags.

Tables: Headers - Failed

This is usually caused by either: (1) missing table headers, (2) header with incorrect number of columns with the table body, or (3) the header <TR> contains something other than <TD> cells.

  1. In the tag panel, expand the header rows <TR>s under <Table> tag. Delete redundant items under the table header <TR>s so that only <TD>s are kept. For example, removing useless <P> items (Word-to-PDF conversion may create such items) under header <TR>s.
  2. Table Editor: Right click on the <Table> tag in the panel, select "Table Editor".
    • To better use table editor, I suggest right click on a cell and open Editor Options.
      • Check the mutlirow/multicol cell display. I prefer them in lightgreen.
      • Change the selected cell color to an eyecatching one. I prefer bright blue.
      • I usually change the border color to red.
  3. In the table editor, select all column header cells (with the same colspan), right click to show Properties.
    1. Choose type Header Cell and select Column from the dropdown list.

      NOTE: In some cases, you don't need to change the Colspans as below, because changing the cell to column type is enough to fix the accessibility failure. Re-check your table to see if it is the case.

    2. Adjust the colspan.
    3. Click on Confirm.
  4. If the table has row headers, select all row header cells (with the same rowspan) and change rowspan values in the Properties dialog like above.
  5. Go back to the Accessibility panel, right click on the item and choose "Check Again".

It's common that you get table regularity error after fixing table header problems. See the Tables: Regularity - Failed section for details.

For multipage table headers

Be careful since this method may NOT work as you expect. A safer solution is to treat continuous table headers just as normal headers unless the accessibilty checker firmly raises an error.

This is a special case of the header failure (sometimes it shows as a regularity failure instead).

Deleting the continuous table header can help screen readers avoid reading headers repeatedly.

  1. In the Tag panel, locate the <TR> tag of the header row on the continuous page.
  2. Hold Ctrl and click on the expanding button next to the <TR> tag to expand it and all its children items.
  3. Hold Shift and multiselect all these leaf items (usually are Content items under <P>s).
  4. Right click and choose Change to Artifact. It is OK to confirm with the default Page style.
  5. (Optional) You can re-open the table editor of this <Table>. Now the header tags are untracked from the Tag panel. Click on the all-expanded <TR> tag that you just changed to artifact with, you can see that nothing is highlighted in the tabl editor.
  6. Now this <TR> tag contains nothing, so you can just delete it from the panel.
  7. Go back to the Accessibility panel, right click on the item and choose Check Again.

Tables: Regularity - Failed

Before correcting all cells of a large table, I suggest you first install a free plugin called Callas pdfGoHTML. It largely helps you check table problems by converting PDF into several well-formatted HTML views.

  1. Be sure to make a backup copy before you start doing this! Especially before clicking the confirm button when Acrobat warns you that changing colspan or rowspan would modify the doc structure.
  2. Correct cell colspans and rowspan like header cells. The principle is that the sum of colspan for each row should be all equal (including header rows). Similar for the sum of rowspan for each column.
  3. If you find that some cells are missing/unclickable after a colspan or rowspan change, run the pdfGoHTML from the top Plug-in menu.
    • When you see an empty <TD> (i.e. an <TD> without <P> inside) in your plugin's view, find this row in your Acrobat tag panel, and delete such empty <TD>s. This helps Acrobat rebuild the table structure.
    • I suggest use Structure Tags view for better comparison. You should see each table row be of same length.
  4. Do your best on correcting colspans and rowspans. Make backup frequently.
  5. Run the pdfGoHTML plugin again to check if the table is well-structured. Double check that there is no empty <TD> under each row.
  6. Double check that there is no empty <TR> under the <table> in the tag panel.
  7. Go back to the Accessibility panel, right click on the item and choose Check Again.

Tables: Summary - Skipped

(This error is often skipped automatically. It asks for adding a summary for each table in the PDF.)

  1. On the right side panel of accessibility, click on "Reading Order".
  2. On the center viewing window, scroll to find the table you want to add a summary.
  3. Right click on any text in the table, and choose "Edit table summary".
  4. Enter the summary in the pop-up window.
  5. Go back and check again.

Heading: Appropriate nesting

This may be caused by: (1) The firsting heading of the doc is lower than <H1>, or; (2) A heading is more than 1 level lower than the previous one, say, a <H4> after <H2> with no <H3> in between.

To fix this, go to the tag panel and change the level of the heading tag directly. You may multiselect and right click on them to open "Properties" and edit their "Type" under the "Tag" tab.

Credits

Thanks PDF Accessibility for recommending the plug-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment