[Webkit-unassigned] [Bug 288719] New: AX: [a11y] Automatically create outline (table of contents) metadata from page's headings (<h1>, <h2>, etc.) when printing/saving a page to PDF

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 27 07:30:44 PST 2025


https://bugs.webkit.org/show_bug.cgi?id=288719

            Bug ID: 288719
           Summary: AX: [a11y] Automatically create outline (table of
                    contents) metadata from page's headings (<h1>, <h2>,
                    etc.) when printing/saving a page to PDF
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Enhancement
          Priority: P2
         Component: Accessibility
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nekohayo at gmail.com
                CC: andresg_22 at apple.com,
                    webkit-bug-importer at group.apple.com

Created attachment 474369

  --> https://bugs.webkit.org/attachment.cgi?id=474369&action=review

Screenshot of the PDF generated by Safari, lacking an outline in the sidebar

## Summary

Both for convenience and accessibility compliance reasons, in addition to the page title being preserved into the PDF title metadata (bug #285313), when "printing" (saving) a page to PDF, the web browser engine should automatically create the dynamic table of content that gets shown in PDF readers' sidebars, which lists the headings and their corresponding page position (so that the software and the user can easily know the entire document structure and more easily navigate through it.

Currently, neither Safari (WebKit) nor Epiphany (WebKitGTK) do that, as can be seen in the attached screenshots of the resulting PDFs.

Here are some examples of pages that can serve as easy testcases, as they make good use of h1/h2/h3 headings:

* https://en.wikipedia.org/wiki/WebKit
* https://theconversation.com/what-canada-can-learn-from-the-european-union-about-dealing-with-chaos-and-crises-249462



## Info about implementation in Skia

Searching for "pdf heading print" in Chromium's issue tracker, I found https://issues.chromium.org/issues/41387522 where we see mentions of the Skia graphics library where this feature is available, including:

* This merge request in Skia: https://skia-review.googlesource.com/c/skia/+/765519
* …merged as this resulting commit: https://skia.googlesource.com/skia/+/5075f1

Additional things I found:

* https://skia.org/docs/dev/design/pdftheory/
* https://api.skia.org/structSkPDF_1_1StructureElementNode.html ; I'm not sure if this is the right thing to use or not (through the a11y tree?)
* https://issues.chromium.org/issues/383706655 potentially related issue for headlines that have wrapped text

Corresponding requests on the Firefox side:

* https://bugzilla.mozilla.org/show_bug.cgi?id=1939532
* https://bugzilla.mozilla.org/show_bug.cgi?id=1950656

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20250227/bdd60252/attachment.htm>


More information about the webkit-unassigned mailing list