exportToPdfDocument method

Future<Document> exportToPdfDocument(
  1. String frameId, {
  2. ExportOptions? overrideOptions,
})

Exports the ExportFrame with the given frameId to a pw.Document.

Implementation

Future<pw.Document> exportToPdfDocument(String frameId,
    {ExportOptions? overrideOptions}) async {
  final ExportFrame? frame = _registeredFrames[frameId];

  if (frame == null) {
    throw Exception('No frame with id $frameId found');
  }

  if (overrideOptions != null) {
    ExportDelegate delegate = copyWith(options: overrideOptions);
    return await delegate._exportDocument(
        frame.exportWidget, frame.exportContext!);
  }

  return await _exportDocument(frame.exportWidget, frame.exportContext!);
}