简体   繁体   English

如何在 flutter 中的 webview 中显示 pdf

[英]How to show pdf in webview in flutter

How to show pdf in webview in flutter.如何在 flutter 的 webview 中显示 pdf。

I have already uploaded pdf fle to fireabse database and storage.我已经将 pdf 文件上传到 fireabse 数据库和存储。 . .

Now I want to download and open te pdf in retrieving page or homescreen现在我想在检索页面或主屏幕中下载并打开 te pdf

I have recieved the downloadURL of the pdf uploaded too我也收到了上传的 pdf 的下载地址

Container(
    child: PDfFile1 != null && WCardPDFURL == null ? PDF.file(
      PDfFile1,
      height: 600,
      width: MediaQuery.of(context).size.width * 0.90,
    ) : PDfFile1 == null && WCardPDFURL == null?
    FlatButton(
        onPressed: (){
          _getLocalImage4();
        },   child: Icon(Icons.picture_as_pdf,size: 80,color:Colors.red,) ) :

    //Image.file(PDfFile1, width: 200, height: 100,),
    Image.file(
      PDfFile1,
      fit: BoxFit.cover,
      height: 250,
    ),
  ),

If your PDF file is in firebase storage you can create a url for your PDF with firebase storage. If your PDF file is in firebase storage you can create a url for your PDF with firebase storage. Then open this URL in a Web_view with webview_flutter plugin.然后使用webview_flutter插件在 Web_view 中打开这个 URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM