PdfRewriteOptions class

What the rewrite preserves from the source document.

Each key answers a single question: does this stay in the new file? Whatever is not reachable from the document catalog never stays — that is exactly what the rewrite is about.

The three signature keys (rejectSignedSources, keepInvalidSignatures and removeSignatureAppearance) are the same as in PdfMergeOptions, with the same semantics and the same precedence: rejecting beats keeping, and keeping beats removing the stamp.

Constructors

PdfRewriteOptions({bool keepDocumentInfo = true, bool keepXmpMetadata = true, bool keepAttachments = true, bool keepLayers = true, bool keepBookmarks = true, bool keepPageLabels = true, bool keepAnnotations = true, bool keepFormFields = true, bool keepStructureTree = false, bool deduplicateResources = true, bool rejectSignedSources = false, bool keepInvalidSignatures = false, bool removeSignatureAppearance = false})
Configures the rewrite.
const
PdfRewriteOptions.sanitized()
Sanitizing profile: keeps only pages, content and annotations.
const

Properties

deduplicateResources → bool
Reuses a single object for identical streams (embedded fonts, logos repeated across several pages).
final
hashCode → int
The hash code for this object.
no setterinherited
keepAnnotations → bool
Copies the page annotations (links, notes, stamps, widgets).
final
keepAttachments → bool
Copies the embedded files (/Names /EmbeddedFiles).
final
keepBookmarks → bool
Copies the bookmark tree (/Outlines).
final
keepDocumentInfo → bool
Copies title, author, creator, subject, keywords and producer from the /Info dictionary.
final
keepFormFields → bool
Copies the form fields (/AcroForm).
final
keepInvalidSignatures → bool
Keeps the signature fields with CMS and certificates.
final
keepLayers → bool
Copies layers / optional content groups (/OCProperties).
final
keepPageLabels → bool
Copies the page numbering (/PageLabels).
final
keepStructureTree → bool
Copies the structural tagging (tagged PDF: /StructTreeRoot, /MarkInfo and the /StructParents of the pages).
final
keepXmpMetadata → bool
Copies the XMP packet from the catalog (/Metadata).
final
rejectSignedSources → bool
Refuses to rewrite a document that has a digital signature.
final
removeSignatureAppearance → bool
Also removes the visual stamp of the signature.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({bool? keepDocumentInfo, bool? keepXmpMetadata, bool? keepAttachments, bool? keepLayers, bool? keepBookmarks, bool? keepPageLabels, bool? keepAnnotations, bool? keepFormFields, bool? keepStructureTree, bool? deduplicateResources, bool? rejectSignedSources, bool? keepInvalidSignatures, bool? removeSignatureAppearance}) → PdfRewriteOptions
Copy with the given keys replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMergeOptions() → PdfMergeOptions
Translates into the options of the object importer.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited