Reputation: 215
I try to show pdf documents on flutter web, I am very new to flutter and not sure whether the Webview and Pdf plugin is available on flutter web yet. if yes can you please show me some example links? If not, is there any alternative solution?
Thank you
Upvotes: 7
Views: 27300
Reputation: 2894
The best way is to use Google Docs Viewer.
Convert your pdf URL from(for example:)
"https://yourdomain.com/yourpdffile.pdf"
to
"https://docs.google.com/viewer?url=https://yourdomain.com/yourpdffile.pdf"
And then use it in your WebView
Upvotes: 11
Reputation: 370
I tried many of these plugins for PDF rendering on web, and found out that this is the best package for that, the most reliable:
https://pub.dev/packages/syncfusion_flutter_pdfviewer
Upvotes: 1
Reputation: 1857
If possible, you can display PDF documents and visit online websites using the add-in:
import 'dart:html' as html;
html.window.open('http:///www.website.com/document.pdf');
or generate pdf documents using the add-in: https://pub.dev/packages/pdf.
I hope I have resolved the doubt, regards.
Upvotes: 1
Reputation: 1779
You can use WebView() widget to show PDF online and it works fine. Here is the Code,
WebView(
initialUrl: ('https://docs.google.com/gview?embedded=true&url=${yourPdfPath}'),
javascriptMode: JavascriptMode.unrestricted,
)
Upvotes: 10