* Render: an isolated CMYK group of any size blends in CMYK, in bands hayro patch (27) blended an isolated DeviceCMYK transparency group in CMYK only up to 2^24 device pixels (a 4096 x 4096 square); a larger one was blended in RGB. Print as image renders a whole page at once, up to 8192 px on the long side, so a page enlarged to 11 x 17 in at 600 dpi (about 43 MP) blended any group covering most of it in RGB, and a print test file's CMYK blend patches drew their X's. The same applied to exporting a large page as an image. A larger group is now blended in bands of whole rows, each within the old limit: both ink passes and the tint conversion run per band, so their memory stays as before, and only the finished group (4 bytes a pixel) is kept whole. Every band is blended before any is drawn, so a group a pass has no tints for is still drawn as before, whole. The regression test lowers the band to 7 rows (set_cmyk_band_pixels, hidden, per thread like set_skip_offscreen_paths) and checks the banded group matches the whole one across an anti-aliased edge, and is CMYK's green where magenta is under black with Difference. * Test: CMYK green through the profile is (0, 166, 81); check green against RGB's magenta
hayro
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 ofhayro-interpretfor more information.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.