directPrintPdf static method
- required Printer printer,
- required LayoutCallback onLayout,
- String name = 'Document',
- PdfPageFormat format = PdfPageFormat.standard,
- bool dynamicLayout = true,
- bool usePrinterSettings = false,
- OutputType outputType = OutputType.generic,
- bool forceCustomPrintPaper = 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)
Set outputType to OutputType.generic to use the default printing
system, or OutputType.photos to use the photo printing system.
(Supported platforms: iOS)
Use customPrintPaper to force the printer to use a custom paper size.
Use value true to use format as custom paper size, when the printer
driver will not allows the user to use papers which are actually supported by the printer.
(Supported platforms: iOS)
Implementation
static FutureOr<bool> directPrintPdf({
required Printer printer,
required LayoutCallback onLayout,
String name = 'Document',
PdfPageFormat format = PdfPageFormat.standard,
bool dynamicLayout = true,
bool usePrinterSettings = false,
OutputType outputType = OutputType.generic,
bool forceCustomPrintPaper = false,
}) {
return PrintingPlatform.instance.layoutPdf(
printer,
onLayout,
name,
format,
dynamicLayout,
usePrinterSettings,
outputType,
forceCustomPrintPaper,
);
}