exportToPdf method

Uint8List exportToPdf({
  1. String? title,
  2. String? password,
  3. String? watermarkText,
  4. bool isEncrypted = false,
  5. bool enableCompression = true,
})

Exports all pages to a multi-page PDF byte buffer.

Implementation

Uint8List exportToPdf({
  String? title,
  String? password,
  String? watermarkText,
  bool isEncrypted = false,
  bool enableCompression = true,
}) {
  final results = _pages.map((p) {
    return PdfExporter.exportResultsToPdf(
      results: [],
      title: title ?? name,
      password: password,
      watermarkText: watermarkText,
      isEncrypted: isEncrypted,
      enableCompression: enableCompression,
    );
  }).toList();

  if (results.isEmpty) {
    return PdfExporter.exportResultsToPdf(
      results: [],
      title: title ?? name,
    );
  }

  return results.first;
}