Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] PrintJobOrientation _TypeError (type 'Null' is not a subtype of type 'int') #2413

Closed
1 of 2 tasks
AliYar-Khan opened this issue Nov 12, 2024 · 6 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@AliYar-Khan
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

It crashes on printing the web page using the example here
https://inappwebview.dev/docs/webview/print-job-controller/

Expected Behavior

It should print the web page to pdf

Steps with code example to reproduce

Steps with code example to reproduce
IconButton(
              onPressed: () async {
                // dispose any previous print job
                printJobController?.dispose();

                final jobSettings = PrintJobSettings(
                    handledByClient: true,
                    jobName:
                        "${await webViewController?.getTitle() ?? ''} - PDF Document example",
                    colorMode: PrintJobColorMode.MONOCHROME,
                    outputType: PrintJobOutputType.GRAYSCALE,
                    orientation: PrintJobOrientation.LANDSCAPE,
                    numberOfPages: 1);

                printJobController = await webViewController?.printCurrentPage(
                    settings: jobSettings);

                if (defaultTargetPlatform == TargetPlatform.iOS) {
                  printJobController?.onComplete = (completed, error) async {
                    if (completed) {
                      if (kDebugMode) {
                        print("Print Job Completed");
                      }
                    } else {
                      if (kDebugMode) {
                        print("Print Job Failed $error");
                      }
                    }
                    printJobController?.dispose();
                  };
                }

                final jobInfo = await printJobController?.getInfo();
                if (kDebugMode) {
                  print(jobInfo);
                }
              },
              icon: const Icon(Icons.print))
        ],

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

3.24.4

Operating System, Device-specific and/or Tool

Flutter 3.24.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 603104015d (3 weeks ago) • 2024-10-24 08:01:25 -0700
Engine • revision db49896cf2
Tools • Dart 3.5.4 • DevTools 2.37.3

Plugin version

v6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@AliYar-Khan AliYar-Khan added the bug Something isn't working label Nov 12, 2024
@pichillilorenzo pichillilorenzo changed the title _TypeError (type 'Null' is not a subtype of type 'int') [Android] PrintJobOrientation _TypeError (type 'Null' is not a subtype of type 'int') Nov 12, 2024
@AliYar-Khan
Copy link
Author

@pichillilorenzo how to use this fix ? use the beta version ?

@pichillilorenzo
Copy link
Owner

Currently on master branch only, new beta version will be released as soon as possible

@AliYar-Khan
Copy link
Author

@pichillilorenzo still getting issue on beta version

@pichillilorenzo
Copy link
Owner

Beta version 6.2.0-beta.2 is not yet published. You can try to use the master branch.

@pichillilorenzo
Copy link
Owner

Released new version 6.2.0-beta.2 with the fix.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants