NOTE
This PR body was truncated due to platform limits.
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| printpdf | dependencies | minor | 0.7 → 0.13 |
Release Notes
fschutt/printpdf (printpdf)
v0.13.0
Added
-
The features
text_layout_hyphenation_allandhtml_hyphenation_allembed the hyphenation dictionaries of all 82 languages.text_layout_hyphenation, and sohtml, hyphenate English (US) only, which makes the binary 2.9 MB smaller (the WebAssembly demo was 13.8 MB). -
ppdf, a command-line tool inppdf/(its own crate, not part of the printpdf package). It converts a PDF to JSON and back so the document can be edited withjq, prints text, text boxes, SVG pages, fonts and images, and renders HTML to PDF. Seeppdf/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 indocs/API.md. -
docs/HTML.mddocuments the HTML and CSS thatfrom_htmlsupports. It replacesSYNTAX.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_usedand its relatives, set insrc/lib.rs). A CI job runs clippy with--all-features,--no-default-featuresand--no-default-features --features text_layout. Onwasm32-unknown-unknowna panic traps and cannot be caught, so a failure has to come back as anErr, 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_textandskip_first_pagedraw 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::Formwith its ownops,/BBoxand resources, and it is written back as a form.extract_text,extract_text_boxesandto_svgread 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_streamandPdfDocument::add_formcreate a form in code, for example a watermark that several pages draw. -
Variable fonts from Rust code (feature
text_layout):font_variation_axeslists the axes of a font,instantiate_variable_font_bytescreates a static font at chosen axis values, andPdfDocument::add_variable_fontregisters such an instance. TrueType (gvar) and CFF2 fonts work; a CFF2 instance is converted to CFF1, which a PDF can embed. The types areFontVariationTag,FontVariationAxis,FontVariationSettingsandVariableFontError. Based on #278 by NicTanghe. -
shape_lineturns a string into positioned glyphs in one font without HTML (featuretext_layout, nothtml): script and direction come from the text, kerning and mark offsets are applied, and the result is aPlacedLinewith thePlacedGlyphs and the width, ready forshow_placed_glyphs.LineShapershapes many lines in one font without copying the font each time.examples/shape_line.rsshows Latin, Arabic and mixed-direction lines (#229, #230). -
Patterns as fill and stroke colors.
Pattern::Tiling(a repeated drawing, colored or uncolored) andPattern::Shading(a gradient that fills or strokes the shape) are registered withPdfDocument::add_patternand selected withOp::SetFillPatternandOp::SetOutlinePattern. A PDF that sets/Pattern cs /P1 scnkeeps 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 asPattern::Externaland written as it was read. The SVG preview draws a pattern as one solid color, with a warning. Seeexamples/patterns.rs. -
Preflight (
printpdf::preflight):preflight_bytes,PdfDocument::preflightandPdfDocument::preflight_with_optionscheck a PDF and return aPreflightReportof findings, each with a severity, a stable rule id (RULESlists 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_2001andPdfX3_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_CHECKEDlists 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 withpdfaid:partandpdfaid:conformanceand the title, author, subject, keywords, creator, producer and dates of the Info dictionary as the same values; an output intent with/S /GTS_PDFA1,/OutputConditionIdentifierand 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/Printflag on link annotations.tests/pdfa_output.rschecks this against the preflight and, whenverapdfis installed, against veraPDF 1.30 (--flavour 1band2b): 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,SymbolandZapfDingbats, levelaandu, 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
/Ccolour 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
/CIDSetin 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,WinAnsiEncodingand codes in the content stream, so extracted text does not change.SymbolandZapfDingbatsstay 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 (
/CAand/cabelow 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_fontsandis_transparency_allowed. -
A saved PDF/A file is read back as the PDF/A variant that its XMP names. It was
Custombefore, because the variant was only in/GTS_PDFXVersion.
Changed
- Reading
/Pattern cs /P1 scngivesOp::SetFillPattern(andOp::SetOutlinePatternforCSandSCN). Before, the name was read as the gray level 0, so the fill became black, andcswas read asOp::SetColorSpaceFill. A form that sets a pattern from its own resources is now read asXObject::Forminstead of being kept asXObject::External.PdfResourcesandPageStatehave a new field,patternsandpattern_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.
MmandPtcompare NaN equal to NaN and an infinity equal to itself, sox == xholds for every value asEqrequires. 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 todocs/andgen.shtoscripts/gen-examples.sh.scripts/build-demo.shassembles the demo in_site/. - The crates.io package excludes
web/,docs/andppdf/. docs/API.mdnow documents all seven functions of the wasm API. It listed five, used wrong option names (subsetFontsinstead ofsubset_fonts,pageWidthinstead ofpage_width) and atitleinput 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_ditheringandresize_to_fit_sizereturnErrwhen the pixel buffer is not exactlywidth * height * channelssamples, andencode_to_bytesalso for an image of size 0. They used to panic or abort inside the encoder.xml_to_pdf_pagesandxml_to_pdf_pages_debugreturnErrwhen 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:
FormXObjecthasops,bboxand its ownresources(aPdfResources) instead ofbytes; its JSON changes. Forms that a PDF contains areXObject::Formand no longerXObject::External. A form that cannot be read without loss staysExternal, with an info message. to_svgmultiplies nestedcmoperators. It replaced the transform before.savewarns when a variable font added withadd_fontis embedded at its default instance. Useadd_variable_fontto choose the axes.- Pages and forms are read and written by the same functions: both use a
PdfResourcesas their scope for fonts, images, graphics states and shadings. - printpdf depends on
glyph-namesandencoding_rsdirectly (both were in the tree through allsorts). PtandMmorder byf32::total_cmp(-0.0 sorts before 0.0, NaN last), so==andcmpcan differ within the 0.0005 tolerance of==.Pxaddition and subtraction saturate.PageStatehas two more public fields,untracked_savesanduntracked_marked_content.PdfConformance::must_have_icc_profileistrueforX1A_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_metadataistruefor the PDF/A variants.- The
avariants (A1A_2005_PDF_1_4,A2A_2011_PDF_1_7) writepdfaid:conformanceasBand the save warns that level a needs tagged document structure, which printpdf does not write.A2U_2011_PDF_1_7writesBtoo, because printpdf does not check that all text maps to Unicode.get_identifier_stringis 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 asPDF/A-1b:2005. - The README roadmap and the
conformancemodule 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_embeddingandimage_optimizationfields ofGeneratePdfOptions.from_htmlnever read them: fonts are always embedded, and image recompression isPdfSaveOptions::image_optimization. JSON that still contains the fields is accepted and the fields are ignored. - Breaking:
render_to_svgandrender_to_svg_asyncare no longer public. UsePdfPage::to_svg,PdfPage::to_svg_asyncorPdfDocument::page_to_svg;PdfToSvgOptionsstays. - 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.mdis 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 theD: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_allowedisfalsefor 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
/Countnow counts only the bookmarks that are written. - Reading a CMap (
/ToUnicodeor 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
begincidrangewhose destination runs pastu32::MAXmaps 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
/Nextcycle 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/Countis huge no longer panics withcapacity overflow(the parser,optimize_textand 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_bytessets limits of 512 MiB and 2^20 pixels per side. q,BMCandBDCnest at most 256 levels deep (deeper ones are counted and warned about once), and a repeatedWorW*on a path that is already clipped is skipped: 28 KB of them produced 4 million points. The SVG output capsqthe same way.- ToUnicode and CID CMaps are limited to 2^20 entries and 1024 codespace ranges, a
usecmapchain no longer takes quadratic time, and the CFF width scan stops after 10,000 steps per glyph (subroutine fan-out hung it)./Wruns 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 /Type1with/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,WinAnsiEncodingand/Differences) and the built-in encoding of its CFF program, where it used to read every code as WinAnsi (ƒtats-UnisforÉ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 wasmPdf_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 anonmouseoverattribute or a<script>element through them, which runs wherever the SVG is inlined into a page, as the web demo does. A link other thanhttp,https,mailto,telor a relative reference (javascript:,data:) is left out with a warning. Font names in the@font-facerule and the<text>elements keep only letters, digits and.,-,+,_.
v0.12.14
Added
- Add
ParsedFont::from_shared_bytes(bytes: Arc<[u8]>, font_index, warnings). It builds the same face asfrom_byteswithout copying the font file and decodes glyph outlines on demand.
v0.12.13
Added
from_htmlsupportsfloat: footnote. A footnote is printed at the bottom of the page where its call appears and continues on the next page if it does not fit.- Footnote calls and markers come from the
footnotecounter (content: noneon::footnote-calland::footnote-markerturns them off).@page { @footnote { ... } }styles the area withborder-top,padding,margin-topandmax-height. - Add
--azul-margin-note: outsidefor absolutely positioned boxes inside multi-column blocks. The box is placed outside the block at the height of its line. This is a layout extension, not CSS.
Changed
- Update azul-css, azul-core and azul-layout to 0.0.20.
Fixed
- Fix repeated table heads missing their text on continuation pages.
v0.12.12
Changed
- Update azul-css, azul-core and azul-layout to 0.0.19.
Fixed
- Fix
text-align: justifystretching a line that ends in a forced break such as<br>. The line is now set from the start edge (CSS Text 3).
v0.12.11
Changed
from_htmlnow converts each page to PDF operations as the layout cuts it (azul-layoutlayout_document_paged_streaming) instead of keeping every page's display list. Output is unchanged. Peak memory for a 227-page document drops from 599 MB to 437 MB (debug build).
v0.12.10
Added
- Add the
formsmodule:parse_form_fieldsreads a PDF's AcroForm fields,fill_formfills or flattens them and stamps drawings onto pages,fields_svgdraws field values as SVG. text_boxeswords now record their standard-14 font, fill colour and whether they are invisible (Tr 3).- Add
show_placed_glyphs(fonts, size, glyphs, actual_text)andPlacedGlyphto write glyphs where an external text layout placed them. It emits oneTJper font stretch, kerned against the/Wwidths fromglyph_pdf_width, and uses text rise for marks. Rotated text matrices work. - Add
actual_text_span(text), the/ActualTextspan the HTML renderer wraps glyph runs in.show_placed_glyphsuses it when given text, so letters that share one glyph copy and search as written. Saving withoptimizedrops the span where the glyphs already read the same.
Changed
- Update azul-css, azul-core and azul-layout to 0.0.18.
Fixed
- Fix SVG
<path>infrom_html: strokes were missing and fills printed as solid boxes. Strokes are now written as PDF strokes (width, caps, joins, miter limit, dashes) and fills are clipped to the path with its fill rule. A mask that is only an image is still painted unclipped. - Fix the SVG renderer drawing cubic curves as quadratics and placing shapes under a
cmtransform in the wrong place. - Fix
rewhen reading a PDF: it now appends a closed rectangle to the current path, sore fno longer draws nothing andre W nno longer paints a box. - Fix runs in synthetic bold, which are now filled and stroked.
- Fix
/ToUnicodelosing the text of a glyph that was later shown without text, such as a mark in a cluster. An empty text now only fills a glyph that has none.
v0.12.9
Added
- Add
optimize_images(pdf, options, warnings)to re-encode the pictures of a finished PDF in place, andoptimize_text(pdf, warnings)to drop redundant/ActualTextspans. Add theoptimize_imagesexample. - Add
bridge::referenced_image_srcs, which lists the<img src>values the laid out pages draw. - Add the
multiple_fontsexample, which switches between faces of a CJK font collection (#283).
Changed
- Update azul-css, azul-core and azul-layout to 0.0.17 (azul#476). The HTML components use azul-core's
ComponentCodegen. from_html*,xml_to_pdf_pagesandadd_xml_to_documentdecode and embed only the pictures the pages draw, once each (#290). Rendering a 1053-page book page by page with 57 pictures drops from 22 to 3.5 minutes.from_html_debug*no longer decodes pictures twice.bridge::resolve_html_imagesstill decodes a whole map.- A shown picture with a missing or undecodable entry is now a warning naming its
srcinstead of an error. An unused entry can no longer fail the call. - Write black-and-white pictures with 1 bit per pixel (#290). They are Flate-compressed even when JPEG is requested.
- Write one text object per line instead of one per word (#288). On a 1000-word page the content stream drops from 45 KB to 17 KB with positioned words and from 32 KB to 12 KB with flowing paragraphs.
optimizemerges consecutive text objects, skips font and colour settings that are already set, and joins adjacent/ActualTextspans on one baseline.- Glyph runs round kerns to whole thousandths of an em and put glyphs without a kern between them in one hex string.
Fixed
- Fix
from_html,from_html_with_cacheandfrom_html_debug_with_cachereturningOkwith an empty document when the HTML loader could not read the page, for example on U+FFFE or a C0 control character. They now returnErrwith the loader's messages (#294, pdfocr #11). - Fix
PdfPage::to_svgre-shaping glyphs in the browser. Shaped runs are now painted from glyph outlines with the PDF's/Wadvances, so Arabic joins, ligatures and Indic conjuncts render as in the PDF (#293). - Fix CID-keyed CFF fonts read from a PDF losing glyph widths when the first hint operator sits in a subroutine.
- Fix HTML text ignoring colour alpha (#287).
color: transparentis now invisible text (3 Tr) that stays selectable and searchable, andrgba()text uses anExtGStatealpha. Translucent inlinebackground-coloris fixed the same way. - Fix
RawImage::optimizedithering before scaling down, which turned a flat grey all white. Dithering is now the last step. - Fix bookmarks on the same page losing their insertion order (#282).
- Fix the bundled base-14 subsets having no space glyph, so every space fell back to a system font. Each of the 14 subsets now has an empty
spaceglyph.!,”and a few others are still missing (#288). - Fix azul#478: a table that overflows a page now fills every non-final page. The page-break regression tests (#291) run by default.
v0.12.8
Changed
- Update rust-fontconfig to 5 (
>=5.0, <6) and azul to 0.0.16. HTML to PDF font fallback now uses rust-fontconfig 5's tiered fallback chain, with per-script faces and an explicit last resort. - Use azul 0.0.16 instead of 0.0.15, which pulled
uuidinto every wasm build and broke--no-default-features --features text_layout(azul#465). build_font_pool(fonts, Some(&["monospace"]))and similar calls scan more fonts than before, because generic families now expand to their per-script fallbacks (13 to 27 fonts formonospaceon macOS).Some(&[])still scans nothing.
Fixed
- The embedded Symbol and ZapfDingbats fonts reported no Unicode coverage, so font fallback never chose them. They now report the 43 and 10 codepoints they map.
- The other embedded standard fonts claimed whole Unicode blocks (Helvetica all 256 of U+0000..U+00FF, against 213 real glyphs), which drew .notdef instead of falling through to a font with the glyph. Coverage now matches each font's cmap.
v0.12.7
Changed
- Allow rust-fontconfig 4.6 within the existing
>=4.4.9, <5range.
Fixed
- The
optimizesave option now compresses page content and embedded font streams with Flate (#284)./Length1keeps the decoded TrueType program size, so readers still load the fonts. - Remove compiler warnings in reduced-feature builds such as
--no-default-features --features gif(#285).
v0.12.6
Changed
- HTML to PDF now paginates with azul's
layout_document_paged_v2and the fullBreakPolicy:break-inside: avoid,widowsandorphans, whole line boxes and table rows across pages, and<thead>repeated on continuation pages. - Pages that hit a break constraint now break earlier than before, by at most a third of the page height per break. Documents without such constraints paginate as before.
- Use the published azul 0.0.14 crates instead of a git pin.
- Allow rust-fontconfig 4.5 and later 4.x releases (
>=4.4.9, <5).
v0.12.5
Changed
- Use the published azul-css, azul-core and azul-layout 0.0.13 instead of the azul git branch, and require rust-fontconfig 4.4.9, which can parse the embedded standard PDF fonts.
Fixed
- HTML rendering resolves
font-family: Helveticaand the other standard PDF fonts (Arial, Times New Roman, Times, Courier New, Courier, Symbol, Zapf Dingbats and the PDF base-14 names) to the embedded fonts instead of logging an unresolved family and substituting another face. - The generic families
serif,sans-serifandmonospaceuse the embedded fonts only as a fallback behind installed fonts (on wasm they are all that is available). Fonts you pass in win over a built-in of the same name. - The embedded Helvetica-Bold and Helvetica-BoldOblique subsets lacked the bold bit, so
font-weight: boldrendered the regular face.
v0.12.4
Fixed
- Text selection in Chrome and Edge (PDFium) now spans the whole line for text from the HTML and layout pipelines. The serializer merges per-glyph
TmandTJpairs on one baseline into a single kernedTJ. Rendering is unchanged.
v0.12.3
Fixed
- CID-keyed CFF fonts (such as NotoSansJP) drew wrong glyphs in Chrome (PDFium) and poppler after the #280 change in 0.12.0 (#281). They are now embedded as a bare CFF table (
/FontFile3,/Subtype /CIDFontType0C) instead of the whole OpenType file, which renders correctly everywhere. ParsedFont::from_bytesreads these bare CFF embeddings back, taking units per em from the FontMatrix and glyph widths from the Type 2 charstrings.
v0.12.2
Changed
- Update azul-css, azul-core and azul-layout to 0.0.12 and require rust-fontconfig 4.4.7.
- Remove the
agg-rust-azul<1.0.3pin from thesvgfeature. azul-layout 0.0.11 and later need agg-rust-azul 1.0.3.
Fixed
- Regular Latin body text in HTML rendering no longer resolves to a CJK font (NotoSansJP). The fix comes with the azul 0.0.12 and rust-fontconfig 4.4.7 updates.
v0.12.0
Yanked from crates.io because the version bump was not warranted. Its changes are included in later 0.12.x releases, so use the latest 0.12.x instead.
Added
- Warn at save time when text-showing operations appear outside
Op::StartTextSectionandOp::EndTextSection, the usual cause of a blank PDF (#254). - Warn when parsing a Type0 font with a non-Identity-H
/Encoding, instead of silently scrambling its text. no_auto_scaleonOp::UseXobjecttransforms, so parsed content keeps its own placement.- WASM API:
Pdf_RegisterFontsregisters the default fonts once instead of resending them on every call, andPdf_DecodeImagedecodes an image or signature into the document'sRawImageJSON. - Rebuilt wasm demo: tabs, live preview, minimap, warnings drawer, dark mode, a browser HTML reference view, JSON tree editing and save/load of the document, font and image extraction from a parsed PDF, and image optimization on save.
Changed
- Raw pixel data serializes as base64 (
{"u8b64": ...}) instead of JSON number arrays, which takes a 1024x1024 RGBA image from about 16 MB to 5.6 MB. The array form still parses. - The wasm API returns a structured error envelope when the response itself cannot be serialized (it returned an empty string).
- SVG
<text>without a resolvable font-family now logs a warning instead of being dropped silently. - Use the published azul-layout 0.0.10, and pin
agg-rust-azulbelow 1.0.3 for thesvgfeature, because 1.0.3 broke freshsvgbuilds.
Fixed
- CID-keyed CFF fonts (such as NotoSansJP) drew wrong glyphs in Acrobat and Preview (#280). The content stream,
/Wwidths and/ToUnicodeare now keyed by the embedded CFF charset's CIDs, as ISO 32000-1 9.7.4.2 requires, on both the subset and the full-embed path. - Parsing resolves Identity-H codes from CID to glyph through
/CIDToGIDMapstreams and CFF charsets, so PDFs from Adobe, dvipdfmx and similar tools re-render correctly. Legacy files that use code equal to glyph id still decode as before. - Font dictionaries: the
XXXXXX+subset tag appears only when the font was subset,/FontNamematches/BaseFont, CIDFontType2 has an explicit/CIDToGIDMap /Identity,.ttcsources embed only the selected face, and ToUnicode synthesis covers supplementary planes. - Subset glyph renumbering now uses the subsetter's own mapping, so shaper-substituted glyphs (ligatures, digit alternates) no longer render as tofu or fall back to their first letter.
- HTML: inline-span backgrounds no longer paint over their own text, and custom
font-familynames, including quoted multi-word names, resolve. - Embedded fonts named
F1toF14are no longer mistaken for the standard 14 fonts on parse or save. - Text decoding resolves the code width per font at
Tfinstead of guessing from string byte parity. Simple fonts decode per byte through ToUnicode or WinAnsi, Type0 fonts use 2-byte codes with per-glyph Unicode from ToUnicode, synthesized from the font's cmap when the PDF has none. - Parsing keeps Form XObjects, undecodable images and printpdf's own FlateDecode raw bitmaps (with
/SMask), and inherits MediaBox through the page tree. - Parsing round-trips the
'and"operators, link annotations (/Rectwas misread), layers (/Propertiesnames) and/Shadingresources withshops. - Relative
TdandTDoperators are accumulated into an absolute text cursor instead of being parsed as absolute positions. - The ToUnicode CMap parser is now a tokenizer. Single-line CMaps, multi-codepoint
bfchartargets and surrogate pairs work, a ligature no longer discards the whole CMap, and regenerated CMaps keep multi-character targets. PdfPage::to_svgrenders text again, upright, on the page, in the embedded font and selectable. A re-parsed document whose only font is a subset still falls back in the browser preview, since a subset is not a valid webfont.- The SVG preview no longer drops text positioned with a text cursor (
Td) to the page bottom, andT*line breaks keep the line-start x. - SVG conversion carries the svg2pdf page's full
/Resourcesinto a self-contained Form XObject and keeps the content stream byte for byte. Gradients, tiling patterns, transparency groups and clip paths now render, where/p0 scnused to come back as0 g(solid black). get_external_font_idsreturns real ids instead of a stub, so page previews receive their fonts.- Saving a document with images without any image-format feature writes raw FlateDecode pixels instead of panicking.
v0.11.3
Changed
- Update azul-css and azul-core to 0.0.10 and azul-layout to 0.0.11, which no longer reads the clock in a way that aborts on browser wasm.
v0.11.2
Added
Svg::parse_with_fontspasses caller-supplied fonts to SVG<text>conversion. Before, only system fonts were used, and none at all on wasm.build_font_pool_with_memory_fontsregisters pre-patternedrust_fontconfigmemory fonts, with their metadata intact, for the HTML and text-layout path.printpdf::htmlre-exportsrust_fontconfigso the pattern types can be built without matching the crate version yourself.
Changed
- Raise dependency floors that admitted versions that cannot build:
time>= 0.3.36 andimage>= 0.25.2. Declarerust-version = "1.88", which lopdf 0.44 already required. - Use weezl 0.2 so dependency graphs link one LZW coder, bound
rust-fontconfigto< 4.5(4.4.4 linked two copies of allsorts), and droptime's unused serde features and a leftover getrandom 0.3 dependency from wasm builds. unix_timestampandfrom_unix_timestampare now the same calendar arithmetic on every target. The old wasm versions used the browser's local timezone, ignored the stored offset and rejected dates before 1970, and wasi returned 0.
Fixed
- 0.11.0 and 0.11.1 could not be installed in workspaces whose lockfile resolved
timebelow 0.3.48 (#279). printpdf no longer enables lopdf'stimefeature, which only gatesObject <-> timeconversions printpdf never used. To get them, enable that feature from your own manifest. PdfDocument::parsepanicked on a/CreationDatecontaining a non-ASCII byte. Dates are now parsed from bytes.- A
/ToUnicodebfrange withend < startpanicked, and a single<00000000> <FFFFFFFF> <0041>line expanded to 2^32 entries (out of memory). Both now return an error that only costs that font its ToUnicode map. - PDF/A and PDF/X XMP metadata wrote single-digit months (
D:2018-9-19T...), which veraPDF rejects. Months are now zero-padded. - The js-sys browser canvas paths are compiled out on wasi targets, whose binaries otherwise carried
windowand canvas imports no wasi runtime can satisfy.
v0.11.1
Added
Svg::parse_with_fontspasses caller-supplied fonts to SVG<text>conversion. Before, only system fonts were used, and none at all on wasm.build_font_pool_with_memory_fontsregisters pre-patternedrust_fontconfigmemory fonts, with their metadata intact, for the HTML and text-layout path.printpdf::htmlre-exportsrust_fontconfigso the pattern types can be built without matching the crate version yourself.
Changed
- Raise dependency floors that admitted versions that cannot build:
time>= 0.3.36 andimage>= 0.25.2. Declarerust-version = "1.88", which lopdf 0.44 already required. - Use weezl 0.2 so dependency graphs link one LZW coder, bound
rust-fontconfigto< 4.5(4.4.4 linked two copies of allsorts), and droptime's unused serde features and a leftover getrandom 0.3 dependency from wasm builds. unix_timestampandfrom_unix_timestampare now the same calendar arithmetic on every target. The old wasm versions used the browser's local timezone, ignored the stored offset and rejected dates before 1970, and wasi returned 0.
Fixed
- 0.11.0 and 0.11.1 could not be installed in workspaces whose lockfile resolved
timebelow 0.3.48 (#279). printpdf no longer enables lopdf'stimefeature, which only gatesObject <-> timeconversions printpdf never used. To get them, enable that feature from your own manifest. PdfDocument::parsepanicked on a/CreationDatecontaining a non-ASCII byte. Dates are now parsed from bytes.- A
/ToUnicodebfrange withend < startpanicked, and a single<00000000> <FFFFFFFF> <0041>line expanded to 2^32 entries (out of memory). Both now return an error that only costs that font its ToUnicode map. - PDF/A and PDF/X XMP metadata wrote single-digit months (
D:2018-9-19T...), which veraPDF rejects. Months are now zero-padded. - The js-sys browser canvas paths are compiled out on wasi targets, whose binaries otherwise carried
windowand canvas imports no wasi runtime can satisfy.
v0.11.0
Added
Svg::parse_with_fontspasses caller-supplied fonts to SVG<text>conversion. Before, only system fonts were used, and none at all on wasm.build_font_pool_with_memory_fontsregisters pre-patternedrust_fontconfigmemory fonts, with their metadata intact, for the HTML and text-layout path.printpdf::htmlre-exportsrust_fontconfigso the pattern types can be built without matching the crate version yourself.
Changed
- Raise dependency floors that admitted versions that cannot build:
time>= 0.3.36 andimage>= 0.25.2. Declarerust-version = "1.88", which lopdf 0.44 already required. - Use weezl 0.2 so dependency graphs link one LZW coder, bound
rust-fontconfigto< 4.5(4.4.4 linked two copies of allsorts), and droptime's unused serde features and a leftover getrandom 0.3 dependency from wasm builds. unix_timestampandfrom_unix_timestampare now the same calendar arithmetic on every target. The old wasm versions used the browser's local timezone, ignored the stored offset and rejected dates before 1970, and wasi returned 0.
Fixed
- 0.11.0 and 0.11.1 could not be installed in workspaces whose lockfile resolved
timebelow 0.3.48 (#279). printpdf no longer enables lopdf'stimefeature, which only gatesObject <-> timeconversions printpdf never used. To get them, enable that feature from your own manifest. PdfDocument::parsepanicked on a/CreationDatecontaining a non-ASCII byte. Dates are now parsed from bytes.- A
/ToUnicodebfrange withend < startpanicked, and a single<00000000> <FFFFFFFF> <0041>line expanded to 2^32 entries (out of memory). Both now return an error that only costs that font its ToUnicode map. - PDF/A and PDF/X XMP metadata wrote single-digit months (
D:2018-9-19T...), which veraPDF rejects. Months are now zero-padded. - The js-sys browser canvas paths are compiled out on wasi targets, whose binaries otherwise carried
windowand canvas imports no wasi runtime can satisfy.
v0.10.1
If you are on 0.10.0, upgrade: in that release every external font embeds as an empty /FontFile2.
Added
printpdf::font::AzulParsedFontre-exportsazul_layout::ParsedFont.
Changed
printpdf::ParsedFontis now a printpdf type, a newtype overazul_layout::ParsedFontwithDeref, that keeps the source font bytes. Field access and method calls are unchanged;into_inner()andas_azul()return the azul face.text_layoutnow pulls inrust-fontconfig.
Fixed
- External fonts embedded as an empty
/FontFile2because azul-layout'sParsedFont::from_bytesno longer keeps the source bytes. printpdf now retains them itself. - Subset fonts had no
.notdefglyph, so the first used glyph was renumbered to glyph 0 and drawn as.notdef. - CFF/OpenType (
OTTO) fonts were written asCIDFontType2with/FontFile2. The subtype now follows the font program, and a fullOTTOfont is written to/FontFile3as/Subtype /OpenType. - Built-in fonts wrote UTF-8 into a
WinAnsiEncodingstream, so non-ASCII text did not copy or search correctly (#273). printpdf now owns the WinAnsi table. - The
'and"text operators ignored the selected font, and text drawn only with them was missing from the PDF. - A font that cannot be embedded now raises a
PdfWarnMsg::errorand omits/FontFileinstead of writing an empty one.
v0.10.0
Changed
- Breaking:
LineDashPatternis now{ offset: f32, pattern: SmallVec<[f32; 8]> }, an arbitrary-length dash array, instead of three fixedOption<i64>dash and gap pairs (#262, PR #263 by @tower120). Build one withLineDashPattern::new(offset, &[dash, gap, ...])orLineDashPattern::solid(). - Breaking: without
text_layout,FontParseWarningis a struct instead of aStringalias, soParsedFont::from_byteshas the same signature with and without the feature (#260). - Breaking: update lopdf 0.39 to 0.44 and allsorts-azul 0.16 to 0.17. Both appear in the public API, so pinning either yourself means bumping in step.
- Remove the
[patch.crates-io]section. printpdf now builds against the crates it publishes, using azul-css 0.0.9, azul-core 0.0.9, azul-layout 0.0.10 and allsorts-azul 0.17.1. The[patch]section is why 0.10.0 shipped with empty embedded fonts (#277).
Fixed
- The HTML renderer no longer crashes on native targets. It uses azul-layout 0.0.10, because the published 0.0.9 wrote to a hardcoded absolute address and segfaulted.
- The HTML renderer no longer aborts when a subset's cmap would be empty, for example when every glyph is a ligature. printpdf embeds the full font in that case.
- External fonts rendered nothing without
text_layout(#258). The fallbackParsedFont::from_bytesnow parses cmap, hmtx, head, hhea and OS/2 with allsorts, andPdfDocument::parsecan read external Type0 fonts back without the feature. - FontDescriptor
/ItalicAngle,/Flagsand/StemVwere hardcoded to 0, 32 and 80 for every font. They are now derived from the hhea caret slope and OS/2usWeightClass(#271). - wasm builds broke on the lopdf update.
getrandomneedswasm_jsenabled for each major version in the graph (0.3 and 0.4).
Security
- Update lopdf to 0.44, which fixes RUSTSEC-2026-0187 (unbounded recursion DoS) (#272, PR #275 by @Zynora-fr).
v0.9.1
Added
PdfDocument::append_document,insert_documentandpage_countfor merging PDFs. Resources and bookmark page numbers are merged and adjusted.PdfDocument::from_html_with_cache,from_html_debugandfrom_html_debug_with_cache, and a publicSharedFontPoolthat reuses parsed fonts across render calls.html_multithreadedfeature: multithreaded font l
IMPORTANT
✂ PR body was truncated to here.
Configuration
📅 Schedule: (UTC)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, 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.
Activity
5IMPORTANT
Review skipped
Bot user detected.
To trigger a single review, invoke the
@coderabbitai reviewcommand.
Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
01ea63c8-cd8e-4c37-98a5-0aac8bf0025cYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- Trigger review
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
- (https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- Mastodon
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
LlamaPReview — Blocking issues found
The printpdf upgrade breaks backend compilation.
Exact-head CI remains unresolved (1 failed); no CI-dependent merge-safety claim is made.
Owner action: Migrate document creation, fonts, drawing, pagination, and saving to the 0.13 API; then run the backend tests and verify the generated report retains its layout and content.
Review details and evidence
| Priority | File | Finding | Evidence |
|---|---|---|---|
| P1 | backend/Cargo.toml | The printpdf upgrade breaks backend compilation. | confirmed |
LlamaPReview checks
- Reviewed changed regions in
backend/Cargo.toml. - Reviewed changed regions in
backend/Cargo.lock. - Read the complete PR-head file
backend/src/report.rs.
Still coding alone? Open CarbonChat, a chat room right inside Codex.
PR author is in the excluded authors list.