printCurrentPage method
- PrintJobSettings? settings,
Prints the current page.
To obtain the PlatformPrintJobController, use settings argument with PrintJobSettings.handledByClient to true.
Otherwise this method will return null and the PlatformPrintJobController will be handled and disposed automatically by the system.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - PrintManager.print)
- iOS WKWebView (Official API - UIPrintInteractionController.present)
- macOS WKWebView (Official API - WKWebView.printOperation):
- If macOS version is less than 11.0, it will use Official API - NSView.printView.
- Web <iframe> but requires same origin (Official API - Window.print):
- PlatformPrintJobController is always
null.
- PlatformPrintJobController is always
- Windows WebView2 (Official API - ICoreWebView2_16.Print)
Parameters - Officially Supported Platforms/Implementations:
settings: all platforms
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
Future<PrintJobController?> printCurrentPage({
PrintJobSettings? settings,
}) async {
final printJobControllerPlatform = await platform.printCurrentPage(
settings: settings,
);
if (printJobControllerPlatform == null) {
return null;
}
return PrintJobController.fromPlatform(
platform: printJobControllerPlatform,
);
}