Articles in this section
Category / Section

How to load Flutter SfPdfViewer from internal storage files?

1 min read

This article explains how to load a PDF document from the internal storage in the Flutter PDF Viewer.

 

The Syncfusion® Flutter PDF Viewer widget provides the support to load a PDF document from Asset, Network, File, and Memory. The SfPdfViewer.file is used to load a PDF document from a file.

 

To load a PDF document from the internal storage in the Syncfusion® Flutter PDFViewer follow these instructions.

 

Step 1: Add read permission [android\app\src\main\AndroidManifext.xml] in the AndriodManifest.xml file.

 

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

 

Step 2: Mention the PDF file path while creating the SfPdfViewer widget as shown in the following code.

 

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: const Text('Syncfusion Flutter PDF Viewer'),
    ),
    body: SfPdfViewer.file(
      File('storage/emulated/0/Download/gis_succinctly.pdf'),
    ),
  );
}
 

 

Screenshot:

Load PDF from internal storage-SfPdfViewer-Flutter.

A complete working sample can be downloaded from here.

Take a moment to peruse the documentation for loading PDF documents. You can also find other options like Asset, Network, and Memory to load the PDF document.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied