printCurrentPage method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'PrintManager.print', apiUrl: 'https://developer.android.com/reference/android/print/PrintManager#print(java.lang.String,%20android.print.PrintDocumentAdapter,%20android.print.PrintAttributes)'), IOSPlatform(apiName: 'UIPrintInteractionController.present', apiUrl: 'https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/1618149-present'), MacOSPlatform(apiName: 'WKWebView.printOperation', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3516861-printoperation', note: 'If macOS version is less than 11.0, it will use [Official API - NSView.printView](https://developer.apple.com/documentation/appkit/nsview/1483705-printview).'), WebPlatform(apiName: 'Window.print', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/Window/print', note: '[PlatformPrintJobController] is always `null`.'), WindowsPlatform(apiName: 'ICoreWebView2_16.Print', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_16?view=webview2-1.0.2849.39#print')])
Future<PlatformPrintJobController?> printCurrentPage({
  1. 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:

Parameters - Officially Supported Platforms/Implementations:

  • settings: all platforms

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'PrintManager.print',
      apiUrl:
          'https://developer.android.com/reference/android/print/PrintManager#print(java.lang.String,%20android.print.PrintDocumentAdapter,%20android.print.PrintAttributes)',
    ),
    IOSPlatform(
      apiName: 'UIPrintInteractionController.present',
      apiUrl:
          'https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/1618149-present',
    ),
    MacOSPlatform(
      apiName: 'WKWebView.printOperation',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wkwebview/3516861-printoperation',
      note:
          'If macOS version is less than 11.0, it will use [Official API - NSView.printView](https://developer.apple.com/documentation/appkit/nsview/1483705-printview).',
    ),
    WebPlatform(
      apiName: 'Window.print',
      apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/Window/print',
      note: '[PlatformPrintJobController] is always `null`.',
    ),
    WindowsPlatform(
      apiName: 'ICoreWebView2_16.Print',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_16?view=webview2-1.0.2849.39#print',
    ),
  ],
)
Future<PlatformPrintJobController?> printCurrentPage({
  PrintJobSettings? settings,
}) {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.printCurrentPage.name} is not implemented on the current platform',
  );
}