Skip to content

Conversation

@gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Jan 8, 2026

Fixes #4426

Also includes

Adds basic support in Typst and LaTeX for PDF standard selection.

PDF versions and standards can be independently specified, so this takes a list. Version specifies the output format; standard specified what validation is applied to the output.

Here are the rules: you can combine standards from different families:

  • PDF/A (archival) + PDF/UA (accessibility) is the common combo
  • PDF version can also be included

The constraint is you can only have one from each category:

  • One PDF version (1.4, 1.5, 1.6, 1.7, 2.0)
  • One PDF/A standard (a-1b, a-2b, etc.)
  • One PDF/UA standard (ua-1, ua-2)
  • One PDF/X standard (x-4, etc.)

It would be equally valid to take pdf-version and pdf-standard as separate options, as LaTeX does, but I chose to follow Typst here and use one option for both.

Once the options have been validated, these go to the command line --pdf-standard for Typst, new \DocumentMetadata{} command for PDF.

The metadata includes tagging=on for any standard in LaTeX.

Auto-installs required LaTeX packages (latex-lab, colorprofiles) when missing.

This includes a test which will fail UA-1 in Typst and warn in LaTeX; these warnings are surfaced from the LaTeX log.

@gordonwoodhull gordonwoodhull requested a review from cderv January 8, 2026 00:11
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jan 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gordonwoodhull gordonwoodhull requested a review from cscheid January 8, 2026 00:14
@gordonwoodhull gordonwoodhull changed the base branch from main to deps/pandoc-2025-08 January 8, 2026 12:54
@cderv
Copy link
Collaborator

cderv commented Jan 9, 2026

Following our meeting discussion, related issues on pdf accessibility

@gordonwoodhull gordonwoodhull force-pushed the feature/pdf-standard branch 3 times, most recently from 21d0394 to 71ab9c4 Compare January 10, 2026 05:08
@gordonwoodhull gordonwoodhull marked this pull request as ready for review January 10, 2026 05:20
@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jan 10, 2026

Clarification: LaTeX does not do compliance validation; that's why it only produces warnings.

We'd have to integrate something like veraPDF to actually validate LaTeX PDFs.

Compliance validation is integrated for Typst.

Base automatically changed from deps/pandoc-2025-08 to main January 14, 2026 10:59
@cderv
Copy link
Collaborator

cderv commented Jan 14, 2026

Probably closing:

Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some quick comments for now as I tried veraPDF install on windows

async function installed(): Promise<boolean> {
const dir = verapdfInstallDir();
const verapdfBin = isWindows
? join(dir, "verapdf.bat")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up that we know .bat file are a problem in some environment. We had some report about dart-sass not working inside Quarto (because this is a bat file).

So a limitation to know about with this veraPdf, though quite specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok let’s talk about the right way. We can probably launch directly. Hopefully we don’t need another Rust launcher. 😉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you manage to run quarto install verapdf on windows with java then I think we're good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I installed a random Java 17 in Windows 11, installed verapdf, and see a nice big validation failure for an example

[verapdf]: Validating ua2-missing-title.pdf against PDF/UA2...FAILED

WARN: PDF validation failed for ua-2:
The Metadata stream as specified in ISO 32000-2:2020, 14.3 in the document catalog dictionary shall contain a dc:title entry
Output created: ua2-missing-title.pdf

Still want to get verapdf testing in windows ci, but I think it can wait.

Copy link
Contributor Author

@gordonwoodhull gordonwoodhull Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this to look in the following order:

  1. If QUARTO_VERAPDF is set, it's assumed to be a verapdf command prefix, like docker run or however people need to run verapdf
  2. Run the JAR from the Quarto installation of veraPDF directly using java (no batch file). This turns out to be safe because the scripts already look for the veraPDF JAR in a forward-compatible way, so we just do the same thing.
  3. Fall back to verapdf on the PATH, if any

Tested on Mac, Windows - let's see how it does in CI!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still want to get verapdf testing in windows ci, but I think it can wait.

Let's open an issue, and we can discuss it. I am happy to take this over when we decide what we want the CI todo (only test verapdf install command, and that our integration is working, or use it also to have test for accessiblity regression)

Copy link
Collaborator

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great aside from one small question on a comment.

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jan 22, 2026

Tests need some help now that I understand standards better.

Typst only supports ua-1 and LaTeX only supports ua-2 so shared tests will have to look like this:

format:
  pdf:
    pdf-standard: ua-2
  typst:
    pdf-standard: ua-1

Most people won't target both formats, so this is mainly a concern for testing, but we'll have to note the differing standards in the documentation.

gordonwoodhull and others added 3 commits January 22, 2026 15:06
Adds `pdf-standard` option for LaTeX and Typst PDF output supporting:
- PDF versions: 1.4, 1.5, 1.6, 1.7, 2.0
- PDF/A: a-1b, a-2a, a-2b, a-2u, a-3a, a-3b, a-3u, a-4, a-4e, a-4f
- PDF/UA: ua-1, ua-2 (LaTeX only)
- PDF/X: x-4, x-4p, x-5g, x-5n, x-5pg, x-6, x-6n, x-6p (LaTeX only)

Features:
- Automatic PDF version inference from standard requirements
- LaTeX image alt text propagation for PDF/UA compliance
- Tagging enabled only for standards that require it
- `quarto install verapdf` for PDF/A and PDF/UA validation
- Automatic validation when verapdf is available

Closes #4426, #13782, #13248

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Workaround for Pandoc not passing alt text to Typst image() calls.
When an image has alt text (from caption or fig-alt), emits raw Typst
with image(..., alt: "...") for accessibility compliance.

Temporary fix until pandoc#11394 is merged upstream.

Closes #13868

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Preserve terms element structure in definition lists for PDF/UA-1
validation. Uses nested show rule instead of .map().join() which
destroyed the list structure.

Suggested by @mcanouil (PR #13249 discussion)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
gordonwoodhull and others added 3 commits January 22, 2026 17:13
- Add QUARTO_VERAPDF environment variable support for custom verapdf
  invocation (Docker, custom Java setups, etc.)
- Use direct Java invocation with quarto-installed JAR by default,
  avoiding .bat file issues on Windows
- Fall back to system verapdf on PATH if JAR not installed
- Log info message when QUARTO_VERAPDF override is used
- Warn if specified QUARTO_VERAPDF path doesn't exist
- Add smoke test validating env var override and validation warnings

Co-Authored-By: Claude Opus 4.5 <[email protected]>
When LaTeX doesn't support a PDF standard (e.g., ua-1), it warns and
ignores it. Previously, verapdf would still try to validate against
the unsupported standard, causing spurious failures.

Now the applied standards are stored in metadata during format extras
and used for validation, so only standards that were actually applied
get validated.

Changes:
- Add kPdfStandardApplied constant for filtered standards
- Store applied standards in extras.metadata during format processing
- Read from pandocOptions.format.metadata for validation
- Add latex-ua1-filtered.qmd test for filtering behavior
- Update latex-multi-standard.qmd to use a-4f + ua-2 (compatible)
- Update latex-combined.qmd to use 1.7 + a-2b (simpler test)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Match pandoc's template by removing the conditional that skipped
pdflang when pdfstandard was set. Having pdflang in both \hypersetup
and \DocumentMetadata is harmless (just redundant).

This simplifies comparison for the passthrough branch.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The test expected both standards (a-2b, ua-1) to appear in DocumentMetadata,
but quarto filters out unsupported standards before passing to pandoc.
Updated test to expect only the supported standard (a-2b) in the output.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@gordonwoodhull gordonwoodhull merged commit 7439715 into main Jan 23, 2026
51 checks passed
@gordonwoodhull gordonwoodhull deleted the feature/pdf-standard branch January 23, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PDF/A-compliant output using pdfx package

6 participants