Skip to content

Check the web renderer with annotations in conformance; render pages in parallel - #615

Open
Velli20 wants to merge 1 commit into
mainfrom
conformance-web-renderer
Open

Velli20 wants to merge 1 commit into
mainfrom
conformance-web-renderer

Conversation

@Velli20

@Velli20 Velli20 commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Web renderer pass. cargo conformance run --renderer web renders each page with the browser stack (pdf-web on a Canvas 2D plus its annotation layer) in the installed headless Chrome, driven over the DevTools protocol. It compares the result with PDFium's render of page content, annotations and form fields. Nothing is downloaded: it uses the system Chrome or Chromium (--chrome / CHROME_PATH).
  • Separate reports. The web pass writes target/conformance/<corpus>-web/ with its own baseline, Pages viewer (/conformance/pdfium-web/) and issues. Its signatures carry [web] after the status, so they never merge with or close Skia issues. issues and repro take report names such as --corpus pdfium-web.
  • Parallel pages. run now reads every document first, then schedules each (document, page) as its own job, so the pages of long documents render side by side. The Skia pass benefits too.
  • render. Takes repeated --page, --all-pages and --jobs, sharing one browser. It writes one combined summary.md, and report.json is now an array of page results.
  • CI. On main, the PDFium corpus is rendered by both renderers (a matrix entry with the runner's preinstalled Chrome, wasm-bindgen-cli 0.2.100 and CONFORMANCE_CHROME_NO_SANDBOX=1), and pdfium-web is filed and published.
  • web-canvas example. Gains render_fitted(page, canvas, width, height) for exact pixel sizes, and an optional password in the WebDocument constructor.
  • New dependencies. tungstenite (TLS off) and base64 in pdf-conformance.

Notes

  • There is no baselines/pdfium-web.json yet, so the first web runs only report. Record one with the workflow's accept input.
  • Draw lists in web failure reports come from the Skia pipeline's trace of the same page content; annotation differences have no draws.

Test plan

  • cargo fmt --check
  • cargo check --workspace --all-targets
  • cargo clippy -p pdf-conformance --all-targets -- -D warnings
  • cargo clippy -p web-canvas-example --target wasm32-unknown-unknown -- -D warnings
  • cargo xtask web-canvas --profile debug
  • cargo conformance render <pdf> --renderer web: one page, run locally by the author
  • cargo conformance render <pdf> --all-pages --renderer web
  • cargo conformance run --corpus pdfium --filter <multi-page case>: results.json statuses and signatures match main
  • Conformance workflow on main: the pdfium, web job completes and publishes pdfium-web

🤖 Generated with Claude Code

…in parallel

Add `--renderer web` to the conformance tool. Each page is rendered by the
browser stack (pdf-web on a Canvas 2D plus its annotation layer) in the
installed headless Chrome, driven over the DevTools protocol, and compared
with PDFium's render of page content, annotations and form fields. The web
pass writes its own report (`<corpus>-web`) with its own baseline, viewer
and issues; its signatures carry a `[web]` tag so they cluster apart from
the Skia renderer's. CI renders the PDFium corpus with both renderers on
main.

`run` now reads every document first and then schedules each page as its
own job, so the pages of long documents render side by side. `render`
takes repeated `--page`, `--all-pages` and `--jobs`, sharing one browser.

The web-canvas example gains `render_fitted` and an optional password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Conformance reads

Documents that Safe-PDF reads differently from the base commit, compared with PDFium. A read
regresses when Safe-PDF fails to open a document it opened before, crashes or times out, or
counts a different number of pages than PDFium.

pdf.js corpus

1009 documents compared with e43007c: 0 read worse, 4 read better.

Improvements

Document Base This pull request
issue17190 timeout: time limit exceeded (stage safe-read) read
issue17190_1 timeout: time limit exceeded (stage safe-read) read
issue2618 timeout: time limit exceeded (stage safe-read) read
issue8078 timeout: time limit exceeded (stage safe-read) read

840 documents of the PDFium corpus read as on e43007c.

Details are in the job summaries of the workflow run. Rerun a case locally with
cargo conformance run --corpus <corpus> --read-only --case <id>.

This branch has not been deployed

No deployments
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.

1 participant