Commit Graph
10 Commits
Author SHA1 Message Date
Karl Seguin 67927b9bde Add PDF support
adds --dump screen.pdf and CDP's Page.printToPDF (along with IO.read and
IO.read). Builds ontop of https://github.com/lightpanda-io/browser/pull/3231

This generates a text-based PDF, not just our PNG placed into a PDF. The biggest
change to the existing (isolated) code was adding href information so that links
are actually clickable.

Like 3231 the hard parts are all Claude but isolated. The one place it diverged
from the plan was NOT using the subsetter rust crate for trimming the size of
the embedded font. It felt that the dependencies were too much (e.g. a second
version of skrifa, ...). One subsetter was removed, the pdf rendering, while
still a blackbox, was moved from Rust to Zig (pdf.zig), which is kind of nice.
2026-08-28 12:53:36 +08:00
Karl Seguin a0e21b9aeb tweak: improve screenshot code
Remove singleton and give each Browser a screenshot.Renderer.

Also, add tests to make sure the Rust and Zig structures/constants match (this
has proven useful with zig-v8-fork).
2026-08-27 19:22:04 +08:00
Karl Seguin de422a72f5 Embed DejaVuSansMono-Bold.ttf for bold headings
fix slant direction for italics
2026-08-25 16:02:51 +08:00
Karl Seguin 49d473d845 cargo fmt 2026-08-19 21:49:02 +08:00
Karl Seguin ed75e929ba improve glyph cache 2026-08-19 21:49:02 +08:00
Karl Seguin 03b05e8ed2 convert rust panics into errors 2026-08-19 21:49:02 +08:00
Karl Seguin e2c16be63a Always honor screenshot clip
Extend the clip if necessary, but never past the content.
2026-08-19 21:49:02 +08:00
Karl Seguin b6960ab5ca Improve screenshot error mapping
Return (height, rc) rather than just height, so that we can correctly detect
a failed raster (which still produced a height). Also add constants for error
codes rather than magic numbers sprinkled here and there.
2026-08-19 21:49:02 +08:00
Karl Seguin 2c7237f259 cap PNG size
The final size is client-driven (for CDP) and a large width/height/scale will
OOM the process.
2026-08-19 21:49:02 +08:00
Karl Seguin ff5b791b7e wip: screenshot 2026-08-19 21:49:02 +08:00