toFile method

Future<DVPrintResult> toFile(
  1. String path, {
  2. required List<Uint8List> pages,
  3. String? title,
})

Writes pages to a PDF at path, one picture per page.

title names the document. Where the platform has somewhere to put it -- a job name, the PDF's own metadata -- that is where it goes; where it has not, the file is written the same either way.

Implementation

Future<DVPrintResult> toFile(
  String path, {
  required List<Uint8List> pages,
  String? title,
}) async {
  _check(pages);
  final Object? result = await DVNativeBridge.require<Object?>(
    'printing.toFile',
    <String, Object?>{
      'path': path,
      'pages': pages,
      if (title != null) 'title': title,
    },
  );
  return DVPrintResult(path: path, pages: _pages(result, pages.length));
}