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

webview javascript window.print #226

Open
z2228391 opened this issue Nov 4, 2018 · 2 comments
Open

webview javascript window.print #226

z2228391 opened this issue Nov 4, 2018 · 2 comments

Comments

@z2228391
Copy link

z2228391 commented Nov 4, 2018

I am using flutter to launch a webview and the webview will call a JavaScript window.print to print the webpage. However, the webview can’t support javascript. Please kindly help to solve this issue.

@slightfoot
Copy link
Member

Please explain more what you want.

@pai-vignesh
Copy link

I have the same problem..i am calling a webview of my invoice.php file which is in server..Webview opens correctly but when i click on print button which is in the webview nothing happens..
But if i run the same invoice.php file chrome and then if click on print..directly a print window opens..Is there any solution for that?
this is my code

`import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class MyWebView extends StatefulWidget {
final String title;
final String selectedUrl;

MyWebView({
@required this.title,
@required this.selectedUrl,
});

@OverRide
_MyWebViewState createState() => _MyWebViewState();
}

class _MyWebViewState extends State {
final Completer _controller =
Completer();

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),

    )
    ,
    body: WebView(
      initialUrl: widget.selectedUrl,
      javascriptMode: JavascriptMode.unrestricted,
      onWebViewCreated: (WebViewController webViewController) {
        _controller.complete(webViewController);
        
      },
    ));

}
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants