Was Using Syncfusion PDF Viewer but it’s displaying grey screen upon release. Any other alternative solutions for pdf viewers in Flutter Web that supports network file?
Was Using Syncfusion PDF Viewer but it’s displaying grey screen upon release. Any other alternative solutions for pdf viewers in Flutter Web that supports network file?
2
Answers
For the web platform, we have used PdfJs for rendering the PDF pages, so the script file must be referred to in your web/index.html file. On your web/index.html file, add the following script tags, somewhere in the head or body of the document:
Script:
pdfjsLib.GlobalWorkerOptions.workerSrc = “//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js”;
UG documentation link: https://help.syncfusion.com/flutter/pdf-viewer/getting-started#add-the-flutter-pdf-viewer-to-an-application
To load PDF from network using SfPdfViewer.network in macOS, network access must be enabled in your macOS application. On your macos/Runner/DebugProfile.entitlements file, add the following lines inside the tag to enable the network access in your application:
com.apple.security.network.client
UG documentation link: https://help.syncfusion.com/flutter/pdf-viewer/getting-started#load-document-from-the-network
Here’s your solution.
So, this is the output of the below-mentioned source code: View
Source code:
Dependent packages: http & pdfx
Note: After installing the pdfx package, run the below-mentioned command: