Add tagged PDF infrastructure for Section 508 accessibility#67
Closed
craigmcnamara wants to merge 4 commits into
Closed
Add tagged PDF infrastructure for Section 508 accessibility#67craigmcnamara wants to merge 4 commits into
craigmcnamara wants to merge 4 commits into
Conversation
Adds marked content operators (BMC/BDC/EMC) and structure tree support to pdf-core, enabling accessible/tagged PDF generation. This is the foundation layer that Prawn and Prawn::Table will build on. New modules: - PDF::Core::MarkedContent — emits BMC/BDC/EMC operators in content streams - PDF::Core::StructureTree — manages StructTreeRoot, structure elements, ParentTree, and MCID allocation Modified: - ObjectStore: accepts marked: true, sets /MarkInfo on Catalog - DocumentState: threads marked option through to ObjectStore - Renderer: includes MarkedContent, creates StructureTree when marked, registers before_render callback for structure tree finalization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allows setting /ActualText on structure elements so screen readers announce replacement text instead of reading visual characters literally (e.g., "required" instead of "asterisk" for *, "selected" for X). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 26, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
craigmcnamara
force-pushed
the
section-508-accessability
branch
from
March 30, 2026 22:07
ad4351a to
d6e686e
Compare
craigmcnamara
added a commit
to mes-amis/prawn-accessibility
that referenced
this pull request
Jul 6, 2026
Repackage the stalled upstream Section 508 / tagged-PDF pull requests (prawnpdf/pdf-core#67, prawnpdf/prawn#1391, prawnpdf/prawn-table#164) as a standalone gem that layers onto the published prawn, pdf-core, and (optionally) prawn-table gems via prepend + additive re-opens — no forking. - pdf-core layer: PDF::Core::MarkedContent (BMC/BDC/EMC) and PDF::Core::StructureTree, plus prepends on DocumentState#initialize and Renderer#initialize and an additive ObjectStore#marked?. - prawn layer: Prawn::Accessibility::DocumentExtensions mixin (tagged?, structure, structure_container, artifact, heading, paragraph, figure) and the marked:/language: document options. - prawn-table layer (optional, auto-applied when loaded): Table/TR/TH/TD tagging with header detection and /Scope. Every modified method delegates to super and only diverges when marked: true, so untagged output is unchanged (guarded by regression_spec). 62 specs pass against prawn 2.5.0 / pdf-core 0.10.0 / prawn-table 0.2.2; rubocop clean. Includes GitHub Actions CI (Ruby 3.1-3.4) and a status badge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the low-level foundation for generating tagged (accessible) PDFs compliant with GSA Section 508 guidelines.
PDF::Core::MarkedContentmodule — emits BMC/BDC/EMC operators in content streams for marking content sequencesPDF::Core::StructureTreeclass — manages the StructTreeRoot, structure elements (/StructElem), ParentTree (number tree), and per-page MCID allocation. Finalizes automatically viabefore_rendercallback.ObjectStore— acceptsmarked: trueoption, sets/MarkInfo << /Marked true >>on the CatalogDocumentState— threads themarkedoption through to ObjectStoreRenderer— includesMarkedContent, createsStructureTreewhen marked, sets minimum PDF version to 1.7, exposesstructure_treeandmarked?accessors/Alt,/ActualText,/Lang, and/Scopeattributes on structure elementsThis is the foundation layer that prawnpdf/prawn and prawnpdf/prawn-table build on for high-level accessibility APIs. See companion PRs there.
Addresses prawnpdf/prawn-table#78
Test plan
🤖 Generated with Claude Code