Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show PDF Inline File for iOS in Flutter

Tags:

ios

pdf

flutter

I am developing an App in flutter specifically for iOS (at this stage) and I need to add PDF file(s) to it. The problem is that flutter has no native way to display PDF files (as far as I researched).

From this tread it looks like it shouldn't it be too difficult to add PDF support to iOS devices using this plugin. However, I am still confused about how exactly to integrate it into my Flutter Application.

Any help would be appreciated!

like image 492
AGoranov Avatar asked Aug 14 '18 06:08

AGoranov


People also ask

How do I open a PDF in Webview in flutter?

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');


2 Answers

If you are looking for quick and easy way to display PDF, this might be the one.

pdf_flutter

Load PDF from network:

PDF.network(
        'https://raw.githubusercontent.com/FlutterInThai/Dart-for-Flutter-Sheet-cheet/master/Dart-for-Flutter-Cheat-Sheet.pdf',
        height: 500,
        width: 300,
        )

Load PDF from files:

File fileName;  
PDF.file(
    fileName,
    height: 200,
    width: 100,
)

Load PDF from assets:

PDF.assets(
    "assets/pdf/demo.pdf",
    height: 200,
    width: 100,
)

enter image description here

like image 150
erluxman Avatar answered Oct 08 '22 16:10

erluxman


When I was implementing the functionality for PDF viewer, there was no PDF plugin.

However, funny enough a friend at work found out that there is already a PDF viewer implemented for Flutter here, which we ended up using.

Note: At the time of writing the question, 16.08 there was not yet any plugin available. The mentioned was created on 30.08.

like image 29
AGoranov Avatar answered Oct 08 '22 15:10

AGoranov