开源Flutter Web PDF Viewer使用网络文件链接解决方案?

问题描述 投票:0回答:1

正在使用Syncfusion PDF Viewer,但发布后显示灰屏。 Flutter Web 中支持网络文件的 pdf 查看器还有其他替代解决方案吗?

flutter pdf syncfusion pdf.js
1个回答
0
投票

对于Web平台,我们使用PdfJs来渲染PDF页面,因此必须在您的web/index.html文件中引用脚本文件。在您的 web/index.html 文件中,在文档的头部或正文中的某个位置添加以下脚本标记:

脚本:

pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js";

UG文档链接:https://help.syncfusion.com/flutter/pdf-viewer/getting-started#add-the-flutter-pdf-viewer-to-an-application

要在 macOS 中使用 SfPdfViewer.network 从网络加载 PDF,必须在 macOS 应用程序中启用网络访问。在您的 macos/Runner/DebugProfile.entitlements 文件中,在标记内添加以下行以启用应用程序中的网络访问:

com.apple.security.network.client

UG文档链接:https://help.syncfusion.com/flutter/pdf-viewer/getting-started#load-document-from-the-network

© www.soinside.com 2019 - 2024. All rights reserved.