pdf_document 1.3.2 copy "pdf_document: ^1.3.2" to clipboard
pdf_document: ^1.3.2 copied to clipboard

Document-level PDF semantics: page tree, annotations, AcroForm filling, digital signatures, and an incremental-save editor. Pure Dart, web-ready.

Changelog #

1.3.2 #

  • Add vector stamp templates (PdfStampTemplate and PdfStampTemplateComponent) with text, shapes, images, and saved-signature components. PdfEditor.addTemplateStamp writes them as normal stamp annotations with generated appearance streams.
  • Stamp annotations can carry metadata (stampType and stampTags) and resolve dynamic {{field}} placeholders at placement time.
  • Note and stamp appearances now account for page rotation when authored, so oriented pages receive counter-rotated annotation appearances.

1.3.1 #

  • Annotation editing now handles malformed or indirect page /Annots entries consistently when adding, removing, reordering, flattening, signing, form editing, redacting, and pasting annotations. Invalid indirect /Annots values are left untouched and replaced by a valid page-owned array.
  • Content rewriting, redaction, and structure-tagging paths now share the COS content-stream serializer, including inline-image round-tripping.

1.2.3 #

  • Free-text annotations carry a horizontal alignment (left/center/right) through the /Q quadding: addFreeText and addFreeTextRich take an align argument, PdfFreeTextStyle.alignment reads it back, and resizing or re-editing a box preserves it. Omitting align keeps the previous behaviour — left for LTR text, right for RTL.
  • Fix a free-text box auto-sized to its contents wrapping the last word onto a new line: the wrapper's strict width test now tolerates the sub-point floating-point round-off in (lineWidth + 2*pad) - 2*pad.

1.2.2 #

  • Embeddable fonts: PdfEmbeddedFont.parse reads a TrueType (.ttf) or OpenType (.otf) file and addFreeText can now author text in it, embedding the font as a full-Unicode Type0/CIDFontType2 (Identity-H) composite with a /ToUnicode CMap — so authored text can use any font, not just the base-14 faces, and stays selectable, searchable, and portable. PdfEmbeddedFont.fromFreeText recovers the font from a box's own appearance for lossless re-editing.
  • Fix non-Latin characters rendering as ?? in free-text annotation appearances.
  • Fix free-text annotation appearances rendering sideways on rotated pages.
  • Right-to-left text direction support in free-text annotations and AcroForm field appearances.
  • Faster batch annotation deletion.

1.2.1 #

  • Add a package example for pub.dev scoring.

1.2.0 #

  • OCR text-layer injection is now used by the standalone app's downloadable on-device OCR flow.
  • Version bump to keep the dart-pdf package suite aligned at 1.2.0.

1.1.0 #

  • Page rotation: PdfEditor.rotatePages(indices, degrees) turns the named pages clockwise by a multiple of 90° (negative for counterclockwise), accumulating onto each page's current /Rotate.
  • Vector snapshots: PdfEditor.captureVectorSnapshot captures a page region as detached vector graphics (PdfVectorSnapshot) and pasteVectorSnapshot re-materializes it onto any page as a /Stamp annotation whose appearance draws the captured content, so a snapshot pasted back into the PDF stays vector (crisp at any zoom), Bluebeam-style.
  • Count tool: PdfEditor.addCheckMark places a Bluebeam-style check-mark stamp annotation (with PdfAnnotation.isCheckMark/iconName). It is the building block for a running on-page tally.
  • Fix: JPEG 2000 tile-part desynchronization, and indexed Lab color palettes now decode correctly.

1.0.0 #

First stable release. Changes since 0.1.0:

  • Line/PolyLine/Polygon annotations: reading and authoring with the full PDF Table 176 line-ending vocabulary, plus reshaping.
  • Measurement annotations (§12.9): PdfMeasure/PdfNumberFormat, scale calibration (setMeasurementScale), and addMeasurement for distance/perimeter/area with a /Measure dictionary and a baked-in formatted caption.
  • True redaction: mark /Redact regions and burn the underlying content irreversibly.
  • Image stamps: PdfEditor.addImageStamp places a PNG/JPEG as a stamp annotation; dashed (/D) stroke patterns for all shape subtypes; and annotation flip when a resize handle is dragged past the zero point.
  • Form widgets: resizeFormWidget rewrites a field's /Rect and regenerates its appearance at the new size.
  • Page assembly: PdfEditor.insertBlankPage adds a new empty page at any position (sized to request, default US Letter), and PdfDocument.extractPageRange exports a contiguous span of pages as a standalone PDF alongside the existing appendPagesFrom (insert pages from another document) and extractPages (arbitrary subset).
  • OCR text-layer injection: PdfEditor.injectTextLayer writes recognized PdfOcrSpans onto a page as invisible (render mode 3) text, sized and horizontally scaled to sit over each word. A scanned, image-only page becomes selectable, searchable, and extractable without changing how it looks. applyOcr (with a pluggable engine) lives in dart_pdf_editor.
  • PdfImageDocument: assemble a brand-new PDF from a list of PNG/JPEG images, one page per image. This is the pure-Dart half of image/Office ingestion (multi-page TIFF, scans, camera shots).
  • PdfImportSource: a host-provided seam for converting foreign formats (DOCX/XLSX/PPTX, …) to PDF bytes. Interface only; dart-pdf does not implement OOXML→PDF layout.

0.1.0 #

Initial release.

  • PdfDocument: page tree with inherited attributes, metadata, outlines, text-page lookup.
  • PdfEditor: incremental-save editing. Annotation authoring (highlight, ink with pressure, shapes, free text, notes, stamps), flattening, page manipulation (reorder, remove, append across documents, extract), content stamping/deletion/text replacement.
  • Annotations: appearance generation, resize/rotate/restyle, slicing eraser, clipboard snapshots, /NM-keyed diff + replay for sync.
  • Measurements (§12.9): PdfMeasure/PdfNumberFormat (parse/emit/format), scale calibration (setMeasurementScale), and addMeasurement for distance/perimeter/area annotations with a /Measure dictionary, a formatted /Contents, and a caption baked into the appearance (PdfAnnotation.measure/measurementText).
  • AcroForm: field model, filling with regenerated appearances, field administration (add/rename/remove/retype/flatten), button images.
  • Digital signatures: PdfSignature.validate() with optional trust-store chain validation, and signing via saveSigned.
  • Image embedding: JPEG passthrough and full baseline PNG (all bit depths/color types, tRNS, Adam7) with alpha soft masks.
0
likes
160
points
3.28k
downloads

Documentation

API reference

Publisher

verified publisherbenmilanko.com

Weekly Downloads

Document-level PDF semantics: page tree, annotations, AcroForm filling, digital signatures, and an incremental-save editor. Pure Dart, web-ready.

Repository (GitHub)
View/report issues
Contributing

Topics

#pdf #annotations #form #digital-signatures

License

Apache-2.0 (license)

Dependencies

archive, crypto, pdf_cos

More

Packages that depend on pdf_document