directPrintPdf static method
FutureOr<bool>
directPrintPdf({
- required Printer printer,
- required LayoutCallback onLayout,
- String name = 'Document',
- PdfPageFormat format = PdfPageFormat.standard,
- bool dynamicLayout = true,
- bool usePrinterSettings = false,
Prints a Pdf document to a specific local printer with no UI
returns a future with a bool
set to true if the document is printed
and false if it is canceled.
throws an exception in case of error
This is not supported on all platforms. Check the result of info to find at runtime if this feature is available or not.
Set usePrinterSettings
to true to use the configuration defined by
the printer. May not work for all the printers and can depend on the
drivers. (Supported platforms: Windows)
Implementation
static FutureOr<bool> directPrintPdf({
required Printer printer,
required LayoutCallback onLayout,
String name = 'Document',
PdfPageFormat format = PdfPageFormat.standard,
bool dynamicLayout = true,
bool usePrinterSettings = false,
}) {
return PrintingPlatform.instance.layoutPdf(
printer,
onLayout,
name,
format,
dynamicLayout,
usePrinterSettings,
);
}