Skip to content

Render web page content through PdfRenderer::render_with_text_layout - #584

Merged
Velli20 merged 1 commit into
mainfrom
render-with-text-layout-viewport
Oct 18, 2026
Merged

Velli20 merged 1 commit into
mainfrom
render-with-text-layout-viewport

Conversation

@Velli20

@Velli20 Velli20 commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove the free function render_page_content_with_text_layout; PdfRenderer::render_with_text_layout is now the single content-and-text pass.
  • render_with_text_layout takes the PageViewport and OptionalContentState to render with, so the web path keeps its zoom/DPR/rotation viewport and runtime SetOCGState visibility.
  • PdfRenderer::page and PdfRenderer::default_optional_content are public so callers can build those arguments.
  • WebPageRenderer owns a PdfRenderer (exposing document()) instead of a font system; render looks the page up by index. WebError gains a Renderer variant, and pdf-web drops its pdf-text-engine dependency.
  • The Skia example and conformance harness build the viewport from the backend size and pass the default optional content, matching what PdfCanvas::new computed before.

Test plan

  • cargo clippy --all --workspace, cargo fmt --check
  • cargo test -p pdf-renderer -p pdf-web
  • cargo build --example skia --features skia
  • cargo xtask web-canvas --profile debug
  • cargo check -p pdf-conformance (not run locally: its skia-bindings build needs a download)

🤖 Generated with Claude Code

Remove the free function render_page_content_with_text_layout. The
renderer method now takes the page viewport and optional content state,
so the web page renderer owns a PdfRenderer and uses the same path as the
Skia example and the conformance harness.

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 4565f4c: 1 read worse, 0 read better.

Regressions

Document Base This pull request
issue19517 read, 1 page timeout: time limit exceeded (stage safe-read)

840 documents of the PDFium corpus read as on 4565f4c.

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

@Velli20
Velli20 merged commit a50f12b into main Oct 18, 2026
10 checks passed
@Velli20
Velli20 deleted the render-with-text-layout-viewport branch October 18, 2026 20:45
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