PdfDocumentMerger class
Merges PDF documents into a destination document.
final out = PdfDocument();
final merger = PdfDocumentMerger(out);
merger.append(PdfDocumentParser(bytesA));
merger.append(PdfDocumentParser(bytesB));
merger.finish();
final bytes = await out.save();
The destination must be a brand new document: merging into a loaded document would produce an incremental update containing objects from another file, which is not a valid PDF.
Constructors
- PdfDocumentMerger(PdfDocument destination, {PdfMergeOptions? options})
Properties
- context → PdfImportContext
-
final
- destination → PdfDocument
-
Document that receives the pages.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- options → PdfMergeOptions
-
Options in use.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
warnings
→ List<
String> -
Non-fatal warnings: dropped links, invalidated signatures, renamed
fields.
no setter
Methods
-
append(
PdfDocumentParser source, {String? label}) → List< PdfPage> -
Imports every page of
source. -
finish(
) → void - Finishes the merge, resolving what depends on every source.
-
importPage(
PdfDocumentParser source, int pageIndex, {String? label}) → PdfPage - Imports a single page (zero-based index).
-
importPageRange(
PdfDocumentParser source, int start, int end, {String? label}) → List< PdfPage> -
Imports the page range
[start, end], inclusive on both ends. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited