Skip to content

chore(deps): update Rust crate printpdf to 0.13.0 - #260

Merged
mergify[bot] merged 1 commit into
mainfrom
renovate/printpdf-0.x
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
renovate/printpdf-0.x

Conversation

@renovate

@renovate renovate Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
printpdf dependencies minor 0.12.0 → 0.13.0

Release Notes

fschutt/printpdf (printpdf)

v0.13.0

Compare Source

Added
  • The features text_layout_hyphenation_all and html_hyphenation_all embed the hyphenation dictionaries of all 82 languages. text_layout_hyphenation, and so html, hyphenate English (US) only, which makes the binary 2.9 MB smaller (the WebAssembly demo was 13.8 MB).

  • ppdf, a command-line tool in ppdf/ (its own crate, not part of the printpdf package). It converts a PDF to JSON and back so the document can be edited with jq, prints text, text boxes, SVG pages, fonts and images, and renders HTML to PDF. See ppdf/README.md.

  • web/minimal.html: a single HTML file that makes a PDF in the browser with two wasm calls. It imports the package of the latest release from the demo site, and is deployed with it. Described in docs/API.md.

  • docs/HTML.md documents the HTML and CSS that from_html supports. It replaces SYNTAX.md, which described an API that no longer exists.

  • The library denies unwrap, expect, panic!, unreachable!, todo!, indexing and string slicing outside tests (clippy::unwrap_used and its relatives, set in src/lib.rs). A CI job runs clippy with --all-features, --no-default-features and --no-default-features --features text_layout. On wasm32-unknown-unknown a panic traps and cannot be caught, so a failure has to come back as an Err, a warning or a skipped item.

  • More than 180 regression tests for hostile input in tests/no_panic_*.rs: crafted and mutated PDFs, fonts, images, dates, form values, CSS sizes and JSON of the wasm API.

  • GeneratePdfOptions::show_page_numbers, header_text, footer_text and skip_first_page draw a header, a footer and page numbers on every page (azul-layout 0.0.21; they drew nothing before).

  • Form XObjects are part of the document model. A form read from a PDF is an XObject::Form with its own ops, /BBox and resources, and it is written back as a form. extract_text, extract_text_boxes and to_svg read the text and drawing inside forms (PDFs from macOS Quartz draw their whole page in one form; their text was empty before). FormXObject::new, with_matrix, with_resources, with_group, from_content_stream and PdfDocument::add_form create a form in code, for example a watermark that several pages draw.

  • Variable fonts from Rust code (feature text_layout): font_variation_axes lists the axes of a font, instantiate_variable_font_bytes creates a static font at chosen axis values, and PdfDocument::add_variable_font registers such an instance. TrueType (gvar) and CFF2 fonts work; a CFF2 instance is converted to CFF1, which a PDF can embed. The types are FontVariationTag, FontVariationAxis, FontVariationSettings and VariableFontError. Based on #​278 by NicTanghe.

  • shape_line turns a string into positioned glyphs in one font without HTML (feature text_layout, not html): script and direction come from the text, kerning and mark offsets are applied, and the result is a PlacedLine with the PlacedGlyphs and the width, ready for show_placed_glyphs. LineShaper shapes many lines in one font without copying the font each time. examples/shape_line.rs shows Latin, Arabic and mixed-direction lines (#​229, #​230).

  • Patterns as fill and stroke colors. Pattern::Tiling (a repeated drawing, colored or uncolored) and Pattern::Shading (a gradient that fills or strokes the shape) are registered with PdfDocument::add_pattern and selected with Op::SetFillPattern and Op::SetOutlinePattern. A PDF that sets /Pattern cs /P1 scn keeps its fills and strokes when it is read, and patterns are written and read back in pages and forms. A pattern that has no model, such as a mesh shading, is kept as Pattern::External and written as it was read. The SVG preview draws a pattern as one solid color, with a warning. See examples/patterns.rs.

  • Preflight (printpdf::preflight): preflight_bytes, PdfDocument::preflight and PdfDocument::preflight_with_options check a PDF and return a PreflightReport of findings, each with a severity, a stable rule id (RULES lists the 97 ids), a page, an object and, for some PDF/A-1b rules, the clause of the standard. Profiles: General (file structure, page tree, resources, colour spaces such as the malformed one behind #​211, fonts, content stream balance), PdfA1b, PdfA2b, PdfX1a_2001 and PdfX3_2002 (embedded fonts, output intent, XMP and PDF/A identification, transparency, layers, encryption, JavaScript, LZW, page boxes, Info dictionary). The work and the number of findings are bounded, and hostile files do not panic (tests/no_panic_preflight.rs). It is not a certification and does not replace veraPDF or Acrobat Preflight; NOT_CHECKED lists what it does not look at.

  • ppdf check FILE [--profile general|pdfa-1b|pdfa-2b|pdfx-1a|pdfx-3] [--json] prints the report. Exit code 0: no errors, 1: errors found, 2: the file cannot be read.

  • PDF/A-1b and PDF/A-2b files that pass printpdf's own preflight, and PDF/X-1a:2001 with its output intent. Saving a document with PdfConformance::A1B_2005_PDF_1_4, A2B_2011_PDF_1_7 (and the other PDF/A variants) writes: XMP metadata with pdfaid:part and pdfaid:conformance and the title, author, subject, keywords, creator, producer and dates of the Info dictionary as the same values; an output intent with /S /GTS_PDFA1, /OutputConditionIdentifier and an embedded sRGB profile (the FOGRA39 profile when the document uses DeviceCMYK and no DeviceRGB); the header version 1.4 (PDF/A-1) or 1.7 (PDF/A-2 and 3); and the /Print flag on link annotations. tests/pdfa_output.rs checks this against the preflight and, when verapdf is installed, against veraPDF 1.30 (--flavour 1b and 2b): the oracle document with built-in fonts only, with a TrueType font subset and complete, with and without stream compression, with grey, RGB or CMYK-only colour, and for PDF/A-2b with transparency pass. The PDF/X files, Symbol and ZapfDingbats, level a and u, and CFF fonts in PDF/A-1 are not covered.

  • PDF/A-1 files get an sRGB output intent profile of ICC version 2.1, built at save time from the sRGB colorants and transfer function (PDF/A-1 is based on ICC version 2, and veraPDF rejects the bundled version 4 profile there). PDF/A-2 and 3 use the version 4 profile.

  • A PDF/A document whose output intent is the CMYK profile (it uses DeviceCMYK and no DeviceRGB) has the RGB /C colour of its link annotations left out, with a warning, because PDF/A allows an annotation colour only with an RGB output intent.

  • PDF/A-1 files get a /CIDSet in the descriptor of every subset TrueType CID font.

  • The 14 standard fonts are embedded when the conformance level requires embedded fonts (all PDF/A and PDF/X variants, PdfConformance::must_embed_fonts). They are written as TrueType subsets with the same resource names, WinAnsiEncoding and codes in the content stream, so extracted text does not change. Symbol and ZapfDingbats stay unembedded because the font files that printpdf bundles for them are not the standard glyph sets; the save warns. The save also warns, naming the characters, when a bundled font has no glyph for a character of the text.

  • Save warnings for content that the chosen standard forbids; the content is written as it is. Transparency (/CA and /ca below 1, soft masks, blend modes, transparency groups) in PDF/A-1, PDF/X-1a and PDF/X-3; layers in PDF/A-1, PDF/X-1a and PDF/X-3; the LZW filter, JavaScript and launch actions in PDF/A; JPEG 2000 and JBIG2 in PDF/A-1; embedded files in PDF/A-1 and 2; DeviceCMYK together with DeviceRGB in PDF/A (one output intent cannot cover both); DeviceRGB in PDF/X-1a.

  • PdfConformance::is_pdfa, pdfa_part, pdfa_level, must_embed_fonts and is_transparency_allowed.

  • A saved PDF/A file is read back as the PDF/A variant that its XMP names. It was Custom before, because the variant was only in /GTS_PDFXVersion.

Changed
  • Reading /Pattern cs /P1 scn gives Op::SetFillPattern (and Op::SetOutlinePattern for CS and SCN). Before, the name was read as the gray level 0, so the fill became black, and cs was read as Op::SetColorSpaceFill. A form that sets a pattern from its own resources is now read as XObject::Form instead of being kept as XObject::External. PdfResources and PageState have a new field, patterns and pattern_spaces.
  • The README no longer lists conformance checking as unsupported (it is a subset, see the preflight) and no longer says that PDF/X-3:2002 is covered.
  • Mm and Pt compare NaN equal to NaN and an infinity equal to itself, so x == x holds for every value as Eq requires. Before, Mm(f32::NAN) == Mm(f32::NAN) was false (#​292).
  • Pin every GitHub Action to a commit SHA, give workflow tokens no default permissions, and lint the workflows with zizmor. Dependabot keeps the pins up to date (#​296).
  • Dependabot opens one pull request for all GitHub Actions updates and one for the minor and patch updates of each crate, instead of one per dependency. Major crate updates stay separate.
  • Move the web demo sources to web/, the documentation to docs/ and gen.sh to scripts/gen-examples.sh. scripts/build-demo.sh assembles the demo in _site/.
  • The crates.io package excludes web/, docs/ and ppdf/.
  • docs/API.md now documents all seven functions of the wasm API. It listed five, used wrong option names (subsetFonts instead of subset_fonts, pageWidth instead of page_width) and a title input that does not exist.
  • The README example no longer shows <head><header> and {builtin:pagenum}, which the layout engine does not implement.
  • Write this changelog in one format for every release, and add the releases that had no entry.
  • RawImage::encode_to_bytes, apply_dithering and resize_to_fit_size return Err when the pixel buffer is not exactly width * height * channels samples, and encode_to_bytes also for an image of size 0. They used to panic or abort inside the encoder.
  • xml_to_pdf_pages and xml_to_pdf_pages_debug return Err when the page, or the area inside the margins, is NaN or outside 1 to 1,000,000 pt.
  • A page of a parsed document that cannot be read becomes an empty page with a warning instead of failing the whole document.
  • Breaking: FormXObject has ops, bbox and its own resources (a PdfResources) instead of bytes; its JSON changes. Forms that a PDF contains are XObject::Form and no longer XObject::External. A form that cannot be read without loss stays External, with an info message.
  • to_svg multiplies nested cm operators. It replaced the transform before.
  • save warns when a variable font added with add_font is embedded at its default instance. Use add_variable_font to choose the axes.
  • Pages and forms are read and written by the same functions: both use a PdfResources as their scope for fonts, images, graphics states and shadings.
  • printpdf depends on glyph-names and encoding_rs directly (both were in the tree through allsorts).
  • Pt and Mm order by f32::total_cmp (-0.0 sorts before 0.0, NaN last), so == and cmp can differ within the 0.0005 tolerance of ==. Px addition and subtraction saturate. PageState has two more public fields, untracked_saves and untracked_marked_content.
  • PdfConformance::must_have_icc_profile is true for X1A_2001_PDF_1_3. PDF/X-1a:2001 requires an output intent, and printpdf wrote none, so its files are larger by the FOGRA39 profile (650 KB before compression). must_have_xmp_metadata is true for the PDF/A variants.
  • The a variants (A1A_2005_PDF_1_4, A2A_2011_PDF_1_7) write pdfaid:conformance as B and the save warns that level a needs tagged document structure, which printpdf does not write. A2U_2011_PDF_1_7 writes B too, because printpdf does not check that all text maps to Unicode. get_identifier_string is unchanged.
  • The Info dictionary of a PDF/A file has no /GTS_PDFXVersion. It named a PDF/X standard, and for PDF/A it held a string such as PDF/A-1b:2005.
  • The README roadmap and the conformance module docs say what saving a standard writes, what it only warns about, and that the preflight is not a certification. The PDF/A-1b and PDF/A-2b test documents were checked with veraPDF 1.30; the PDF/X output was not.
Documentation
  • Rewrite the documentation of the public API in plain language for readers who are new to PDF. The crate root has a guide with a first program, and every module explains the part of PDF it covers. All 620 public items that had no documentation now have one, and #![warn(missing_docs)] keeps it that way. Remove history, issue numbers, pasted spec text and examples that did not compile; the 34 doctests all run.
Removed
  • Breaking: the font_embedding and image_optimization fields of GeneratePdfOptions. from_html never read them: fonts are always embedded, and image recompression is PdfSaveOptions::image_optimization. JSON that still contains the fields is accepted and the fields are ignored.
  • Breaking: render_to_svg and render_to_svg_async are no longer public. Use PdfPage::to_svg, PdfPage::to_svg_async or PdfDocument::page_to_svg; PdfToSvgOptions stays.
  • Unused files: the working notes of the image decoding change, subset.ttf, build.sh, a disabled shape test and two example files that were never registered. CHANGELOG2.md is merged into this file.
Fixed
  • The XMP metadata stream of PDF/A, PDF/X and the other standards is written without a filter, which PDF/A-1 requires (it was compressed). The PDF/A XMP packet has no pdf:Trapped, which veraPDF does not accept as a predefined property.
  • The XMP dates (xmp:CreateDate, xmp:ModifyDate, xmp:MetadataDate) are ISO 8601, 2018-09-19T10:05:05+00:00. They had the D: prefix and the +00'00' offset of PDF dates, which XMP does not allow.
  • The output intent that PDF/X-3 and the other standards with an ICC profile write names the profile with /DestOutputProfile. It used /DestinationOutputProfile, which readers do not look for.
  • The XMP metadata escapes the title, creator, subject, keywords, identifier and producer. A title with & or < made the XMP packet invalid XML.
  • PdfConformance::is_layering_allowed is false for PDF/A-1b and PDF/A-1a, which forbid optional content.
  • Saving a document no longer panics when every bookmark points at a page that does not exist, for example after the pages were removed from a parsed document. The outline /Count now counts only the bookmarks that are written.
  • Reading a CMap (/ToUnicode or a Type0 /Encoding) no longer panics on a multi-byte character inside a hex token such as <000é000>; the token is an error and only costs that font its map.
  • A begincidrange whose destination runs past u32::MAX maps the affected codes to CID 0 (notdef) instead of overflowing.
  • Hostile files no longer make the parser loop, run out of memory or overflow the stack. A bookmark /Next cycle stops with a warning. References that fan out (a 2 KB file took 1.6 GB) are inlined within a budget of 2 million objects and 256 MiB per document. A page tree whose /Count is huge no longer panics with capacity overflow (the parser, optimize_text and the form reader read the page list page by page). Image and soft-mask sizes that overflow are rejected. A form field value that refers to itself overflowed the stack: values are read to a depth of 8 and 4096 objects.
  • Every stream read from a document inflates to at most 256 MiB (CMaps 16 MiB), and RawImage::decode_from_bytes sets limits of 512 MiB and 2^20 pixels per side.
  • q, BMC and BDC nest at most 256 levels deep (deeper ones are counted and warned about once), and a repeated W or W* on a path that is already clipped is skipped: 28 KB of them produced 4 million points. The SVG output caps q the same way.
  • ToUnicode and CID CMaps are limited to 2^20 entries and 1024 codespace ranges, a usecmap chain no longer takes quadratic time, and the CFF width scan stops after 10,000 steps per glyph (subroutine fan-out hung it). /W runs and the synthetic sfnt of a CFF font no longer overflow.
  • A multi-byte first character of a timezone offset, and offset parts that overflow, no longer panic in the date parser.
  • The arc of a rounded corner is cut into at most 256 segments (a radius of 1e5 made a million points).
  • Simple TrueType fonts without a Unicode character map keep the glyphs of their codes through parse and save. A saved page from macOS Quartz kept none of its text before.
  • A simple font with an embedded CFF program (/Subtype /Type1 with /FontFile3 /Type1C, as Quartz, Distiller and ps2pdf write it) survives parse and save. A bare CFF font had no character map, so no character found a glyph on save and the font was dropped, with the text unreadable. The font now gets a map from its glyph names (Adobe Glyph List).
  • The text of a simple font follows its /Encoding (StandardEncoding, MacRomanEncoding, WinAnsiEncoding and /Differences) and the built-in encoding of its CFF program, where it used to read every code as WinAnsi (ƒtats-Unis for États-Unis). With poppler as the reference, parse, save and parse again keeps 100% of the words of an Apple CFF PDF and about 80% of two TeX PDFs; it was 0%, 7% and 5%.
  • The SVG output (PdfPage::to_svg, PdfDocument::page_to_svg, the wasm Pdf_PageToSvg) escapes every string it takes from a PDF: the tags of marked content, marker ids, layer ids and names, link targets, font names and the names of unknown operators. A crafted PDF could add an onmouseover attribute or a <script> element through them, which runs wherever the SVG is inlined into a page, as the web demo does. A link other than http, https, mailto, tel or a relative reference (javascript:, data:) is left out with a warning. Font names in the @font-face rule and the <text> elements keep only letters, digits and ., -, +, _.

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@mergify
mergify Bot merged commit 7f5f677 into main Nov 26, 2026
4 checks passed
@renovate
renovate Bot deleted the renovate/printpdf-0.x branch November 26, 2026 07:09
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.

0 participants