Skip to content

v1.23.0

Choose a tag to compare

@Moonwalker1307 Moonwalker1307 released this 04 Nov 21:41
fe4ba52

Highlights

  • Three new packages, released with PdfPecker under the same version:
    • PdfPecker.Cli, the pdfpecker dotnet tool: convert (HTML or Markdown, files or standard input), watch, merge, split, extract, remove, rotate, stamp, compact, linearize, sanitize, sign, verify, encrypt, decrypt, to-image, to-html, text and info. A call without a command reads wkhtmltopdf's options, header and footer texts included. It has no dependencies and refuses web addresses.
    • PdfPecker.Razor: RazorToPdf renders a .razor component with Microsoft's HtmlRenderer and converts it, so templates get typed parameters, child components, layouts and dependency injection without an ASP.NET Core host. Trimmable and AOT-compatible.
    • PdfPecker.Testing: PdfAssert.MatchesSnapshot compares a PDF with a stored one object by object, ignoring dates and IDs, and writes expected, actual and diff page images when they differ; ContainsText, DoesNotContainText and HasPageCount check the rest. No test framework dependency.
  • Existing PDFs to PDF/A. PdfToPdfA.Convert turns a PDF from any tool into PDF/A-2b, 2u, 3b or 3u without rasterizing it: it embeds missing fonts, repairs embedded TrueType programs, adds the output intent and XMP metadata, removes forbidden actions and gives annotations appearances, and reports what it changed and what it could not fix. veraPDF checks all four levels in CI.
  • PDF to Markdown. PdfToMarkdown writes the structure PdfToHtml finds as GitHub Flavored Markdown: headings, paragraphs, lists, bold and italic, links and pipe tables.
  • Barcodes: Barcode.DataMatrix and Barcode.Gs1DataMatrix (ECC 200, GS1 element strings with FNC1), and Swiss QR-bills: SwissQrBill builds and checks the payload (IBAN, QR-IBAN, QR and creditor references) and Barcode.SwissQrCode draws it with the Swiss cross.
  • Empty signature fields. An element with data-pdf-signature="Name" becomes an empty signature field that PdfSigner signs later with FieldName = "Name", tagged as PDF/UA asks.
  • Templates from Prince, WeasyPrint and Chrome: running elements in page-margin boxes (position: running(name) with content: element(name), picked by first, start, last and first-except), @scope for component styles, CSS zoom as Chrome computes it, and even-page headers and footers (data-sticky-pdf-even-header and data-sticky-pdf-even-footer) for documents printed on both sides.
  • More CSS: typed attr() in any property (CSS Values 5, as in Chrome 133), gap decorations in grid and flex containers (row-rule, column-rule lists, rule-break, rule-inset), box-decoration-break: clone for block boxes split across pages, size-adjust, ascent-override, descent-override and line-gap-override in @font-face, target-counters(), white-space-collapse, hyphenate-limit-lines, accent-color and appearance: none for check boxes and radio buttons, :in-range and :out-of-range, image-rendering: pixelated and crisp-edges, continue: discard, @page { size: 80mm auto } for pages as tall as their content, and in SVG vector-effect: non-scaling-stroke, CSS transform with transform-box, and the geometry (cx, r, d, ...) and gradient stop properties from style sheets.
  • PdfPecker's own properties: -pdfpecker-repeat: each-page draws a box again on its parent's later pages, and -pdfpecker-image-quality and -pdfpecker-image-max-resolution make PDFs with photos smaller.
  • Page numbers in any style: the {page}, {pages}, {total-pages} and {section-page:id} tokens in running headers and footers take a counter style, such as {page:upper-roman}, including the document's @counter-style rules.
  • Tagged PDF: role="math" becomes a Formula with its alternative text, role="doc-index" an Index, role="doc-toc" a TOC with TOCI entries, and data-pdf-list-label marks a hand-made list label as Lbl.
  • Closer to Chrome: shapes drawn by an SVG <use> inherit its fill and stroke (sprite icons, MathJax formulas in coloured text), the SVG viewBox scale is exact (MathJax formulas no longer lose their last glyph), and position: fixed boxes such as watermarks paint over the running headers and footers.
  • Existing PDFs: PdfLinearizer linearizes and encrypts in one pass, and opens encrypted input with its password.
  • PdfPecker.Fluent: more QuestPDF calls port unchanged: DocumentOperation (merge, overlay, underlay, attachments, encrypt, linearize), Image and SvgImage objects with WithCompressionQuality, WithRasterDpi and the document image settings, page Background and Foreground, Repeat, StopPaging, ContinuousSize, ExtendLastCellsToTableBottom, Overline, BreakAnywhere, the direction calls and every Semantic* call, Format(PageNumberFormat) for page numbers, gradients and Opacity. Document.Merge, EvenPageHeader and EvenPageFooter, Hyphenate and Language. New: Chart (column, bar, line and pie charts), Leader in text, Markdown content, TableOfContents from headings, SignatureField, DataMatrix, Gs1DataMatrix, SwissQrCode and the whole SwissQrBill payment part with its receipt.
  • Hostile input and speed: a line's footnotes are handed on in linear time (10,000 footnotes on one line in 0.85 s instead of 21 s), stacked floats are no longer quadratic (60,000 floats in 0.3 s instead of 7.1 s), @scope limits are found in one walk (21 s to 2.4 s for the worst case), PdfSanitizer removes active annotations in one pass (35 s to under a second), SVG foreign objects inside patterns and masks no longer throw, and character references such as &#xFFFFFFFF; decode as U+FFFD instead of throwing.

Output changes

Golden baselines changed only where inline SVG is drawn: the viewBox scale is now written with six decimals instead of three, which moves SVG drawings by a fraction of a point (complex/svg-charts, features/images, features/paged-content, image-formats/demo, svg-effects/demo, translucent-effects/demo, and the fluent catalogue and invoice through their barcodes). Documents with inline SVG, especially formulas with large viewBoxes, can therefore differ byte for byte from 1.22.0. New golden pages (features/math-svg, svg-css-geometry, svg-effects/non-scaling-stroke-transform-box, box-decoration-break/demo, features/font-face-metrics, features/gap-decorations, features/attr-charts) add baselines and change none.

Other documents change only when they use a new feature: shapes inside <use> that set no paint of their own now take the <use> element's, and fixed boxes with a z-index of auto or more now paint over the running headers and footers.

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

Full Changelog: v1.22.0...v1.23.0