【问题标题】:Flutter for web write new tabFlutter for web 编写新标签
【发布时间】:2020-01-20 00:29:37
【问题描述】:

所以我有一个 base64 编码字节的 html。

我想做类似的事情

let pdfWindow = window.open("")
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64, " + encodeURI(base64EncodedPDF) + "'></iframe>")

在 web 上颤动。但是,当我运行

var openWindow = html.window.open("", "Form");

我没有能力为 pdf 编写 HTML。

我的目标是能够从浏览器打印 pdf,

有人知道从这里去哪里吗?

【问题讨论】:

    标签: flutter flutter-web


    【解决方案1】:

    使用url_launch包url_launch

    void main() {
    runApp(Scaffold(
    body: Center(
      child: RaisedButton(
        onPressed: _launchURL,
        child: Text('Show Flutter homepage'),
         ),
       ),
      ));
    }
    
     _launchURL() async {
     const url = 'https://flutter.dev';
      if (await canLaunch(url)) {
     await launch(url);
     } else {
    throw 'Could not launch $url';
     }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-01-27
      • 1970-01-01
      • 2021-02-07
      • 2020-12-05
      • 1970-01-01
      • 2022-08-18
      • 2011-02-13
      • 2020-01-29
      • 2019-09-28
      相关资源
      最近更新 更多