flutter_full_pdf_viewer icon indicating copy to clipboard operation
flutter_full_pdf_viewer copied to clipboard

[Feature Request] WEB SUPPORT!

Open MoacirSchmidt opened this issue 4 years ago • 8 comments

It seems that flutter_full_pdf_viewer is not web compatible yet? Congratulations and much thanks for your great solution!

MoacirSchmidt avatar Apr 06 '20 11:04 MoacirSchmidt

Please inform us about your plans on web support. Thank you so much for the great plugin.

nipunasudha avatar Apr 08 '20 19:04 nipunasudha

I'd also love to see it working on web. Any plans for that @albo1337 ?

tomrozb avatar Apr 20 '20 06:04 tomrozb

Currently I am using the url_launcher package for web.

if (kIsWeb) {
  ...url_launcher...
} else {
  ...pdf_viewer....
}

MoacirSchmidt avatar Apr 20 '20 11:04 MoacirSchmidt

Currently I am using the url_launcher package for web.

if (kIsWeb) {
  ...url_launcher...
} else {
  ...pdf_viewer....
}

So does that mean the plugin doesn't break building for the web? Thats great to hear!

nipunasudha avatar Apr 20 '20 12:04 nipunasudha

So does that mean the plugin doesn't break building for the web? Thats great to hear!

No, it doesn't! Thanks to @albo1337 very much!

MoacirSchmidt avatar Apr 20 '20 12:04 MoacirSchmidt

One thing that could help to make this truly web compatible is to allow PDFViewerScaffold to accept something other than a path to a file. For example, I'm using the pdf package (https://pub.dev/packages/pdf) to generate a pdf, and I'd like to be able to show it with flutter_full_pdf_viewer. If I could directly use the Uint8List data generated by pdf package (instead of a String filepath), that would bypass the "create file" step needed by flutter_full_pdf_viewer, and I could just store the result of the pdf generation in Provider until it can be displayed.

wterrill avatar Apr 22 '20 03:04 wterrill

@wterrill this is exactly what I meant. It's fine that it accepts urls, but if you're the one that generates the PDF file and you want to display it right away, you don't want to upload it somewhere to just display it.

We'd love to see the possibility to open the mentioned Uint8List type directly

tomrozb avatar Apr 22 '20 05:04 tomrozb

Perhaps this code might be of use? I posted a stackoverflow question about this, and user Spatz responded with code that uses html pdf display methods to show the document directly from the Uint8List data. It's brilliant. Here's the link: https://stackoverflow.com/questions/61373742/flutter-web-display-pdf-file-generated-in-application-uint8list-format/61395912#61395912

wterrill avatar Apr 24 '20 05:04 wterrill