pdfcraft/vendor/hayro
philip-tam 88d96c93a8
M2: snap shrunk interpolated images to whole pixels so scans stay sharp (#1377)
* M2: snap shrunk interpolated images to whole pixels so scans stay sharp

A scanned page (one 300 dpi image with /Interpolate true) was shrunk to a
ceil-sized raster and then sampled a second time at a fractional scale and
offset, which softened every edge next to Acrobat. An axis-aligned shrunk
interpolated image is now shrunk once to its rounded device rectangle and
drawn 1:1 at the rounded corner. Rotated, skewed, flipped, Type 3 and
non-interpolated images are unchanged.

On a synthetic scan page the mean error against an area-average reference
falls from 3.4 to 1.6 grey levels at 96 dpi (3.0 to 1.5 at 144 dpi).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* vendor: list the hayro snap patch as (14) in the Patches and Tests columns; correct gaps.md patch counts

The patch description had been appended to the Tests column of one of the
two hayro rows. gaps.md now counts the distinct patches vendor/README.md
lists (26 hayro-interpret, 15 hayro, 3 hayro-jbig2, 17 hayro-syntax).

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-12 07:12:02 -04:00
..
examples more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
src M2: snap shrunk interpolated images to whole pixels so scans stay sharp (#1377) 2026-10-12 07:12:02 -04:00
.cargo-ok more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
.cargo_vcs_info.json more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
Cargo.lock more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
Cargo.toml Reading colours: replace document colours for reading comfort (#897) (#1270) 2026-10-12 02:49:31 -04:00
Cargo.toml.orig M2: bound image resampling buffers before allocation (#592) 2026-10-09 18:53:56 -04:00
LICENSE-APACHE more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
LICENSE-MIT more progress, roadmap, wip 2026-09-30 11:00:02 -04:00
README.md more progress, roadmap, wip 2026-09-30 11:00:02 -04:00

README.md

hayro

Crates.io Documentation

A crate for rendering PDF files.

This crate allows you to render pages of a PDF file into bitmaps. It is supposed to be relatively lightweight, since we do not have any dependencies on the GPU. All the rendering happens on the CPU.

The ultimate goal of this crate is to be a feature-complete and performant PDF rasterizer. With that said, we are currently still very far away from reaching that goal: So far, no effort has been put into performance optimizations, as we are still working on implementing missing features. However, this crate is currently the most comprehensive and feature-complete implementation of a PDF rasterizer in pure Rust. This claim is supported by the fact that we currently include over 1000 PDF files in our regression test suite. The majority of those have been scraped from the pdf.js and PDFBOX test suites and therefore represent a very large and diverse sample of PDF files.

As mentioned, there are still some serious limitations, including lack of support for encrypted/password-protected PDF files, blending and isolation, knockout groups as well as a range of smaller features such as color key masking. But you should be able to render the vast majority of PDF files without too many issues.

Safety

This crate forbids unsafe code via a crate-level attribute.

Examples

For usage examples, see the example in the GitHub repository.

Cargo features

This crate has one optional feature:

  • embed-fonts: See the description of hayro-interpret for more information.

License

Licensed under either of

at your option.