Skip to content

v1.22.0

Choose a tag to compare

@Moonwalker1307 Moonwalker1307 released this 01 Nov 09:56
0e638ec

Highlights

  • Page numbers anywhere. counter(pages) gives the page count in the content, not only in the page-margin boxes, as in Prince, and -pdfpecker-target-pages() gives the first and last page of a section, how many pages it covers and the page within it, also on elements without an id ({section-page:name} in running headers and footers).
  • Removing active content. PdfSanitizer.RemoveActiveContent takes JavaScript, actions that launch programs, open other files or submit form data, XFA and media annotations out of PDFs from others, and HasActiveContent tells whether a PDF has any. Pages, text, links and form fields stay.
  • Safer signatures and long-term validation. SHA-1 signatures are no longer Valid unless PdfSignatureVerificationOptions.AllowSha1 is set (PdfSignatureVerification.UsesSha1 says why); verification catches shadow attacks that redirect the cross-reference table after a certification and a dropped /Perms; and FetchRevocationData fetches OCSP and CRL data only from public addresses unless a UrlFilter allows others.
  • More CSS: the grid shorthand, the stretch sizing keyword and -webkit-fill-available for widths, heights and their limits, image-set() in backgrounds, list markers and generated content, text-box, text-box-trim and text-box-edge (lines trimmed to the cap height and baseline, as Chrome trims them), corner-shape (squircle, bevel, scoop, notch and superellipse() corners), overflow-clip-margin, rect() and xywh() in clip-path and shape-outside, text-emphasis, text-indent with hanging, each-line and percentages, font-width, :valid, :invalid and :open, borders, padding and background images on the @page box, and backgrounds on ::first-line.
  • ::marker as in Chrome: a larger marker font or a tall marker image makes its line taller, content: none hides the marker, counter(list-item) numbers it, and its own direction orders its text.
  • Closer to Chrome: icons drawn with <use> from a hidden SVG sprite (as in Bootstrap), a forced break before a box's first child breaks before the whole box (so tables of contents point at the right page), images and inline-blocks aligned to text-top and text-bottom, SVG backgrounds without a viewBox scaled to background-size, flex rows break inside their items at a page's end, quirks-mode line heights, square dots for thin dotted borders, percentage lengths in inline SVG, percentage heights in table cells that span rows, auto margins on floats, the legacy body margin attributes, border-image number widths in standards mode, and a whole shorthand dropped when one part has a unitless length.
  • Fonts: fonts whose only Unicode cmap is format 10 or 13, such as last-resort fonts, are used by HTML to PDF instead of falling back to Helvetica.
  • PdfOptions.Clone() copies shared options so one setting can change without touching the others.
  • PdfPecker.Fluent: page numbers and the page count in the content, EndPageNumberOfSection, TotalPagesWithinSection and PageNumberWithinSection, and cell backgrounds and borders that fill the row in any call order.
  • Hostile input and speed: a total budget for decoded object streams (a 4 MB file could make 9 GB), bounded stream decoding outside a render scope, rasterizer coordinates kept finite, a bounded cache of pattern tiles in the renderer, and fuzzing fixes for JPEG scans, footnote calls, grid items, very tall split table rows and large paginated grids (60,000 grid items lay out in 0.4 s instead of 7.4 s). Text measured with a font-family list allocates about a third of what it did in 1.21.0, and invoices allocate about an eighth less.

Output changes

Golden baselines changed where the output now matches Chrome more closely: square dots for thin dotted borders (features/images, inline-borders/demo), images aligned to text-top (features/images and the PDF-to-HTML pdf-to-html/features-images made from it) and quirks-mode line heights (forms/demo, which has no doctype). Documents without a doctype can have shorter lines of small text and shorter table cells holding only an image; documents with flex rows that cross a page now break inside the row instead of moving it to the next page whole, and a section whose first child has break-before: page now starts on the new page together with its border and background. Eight new golden pages cover the features since 1.17.0; they add baselines and change none.

Verification results change for SHA-1 signatures, which are now reported as not valid; set AllowSha1 to accept them for old archives.

The manual for this version: https://pdfpecker.net/docs/v1.22.0/

Full Changelog: v1.21.0...v1.22.0