Open a PDF From Local Storage in Flutter PDF Viewer (SfPdfViewer)
10 Jul 20261 minute to read
The SfPdfViewer.file creates a widget that displays the PDF document obtained from a File. The following code example demonstrates this.
@override
Widget build(BuildContext context) {
return Scaffold(
body: SfPdfViewer.file(
File('storage/emulated/0/Download/flutter-succinctly.pdf')));
}NOTE
On Android, add the
android.permission.READ_EXTERNAL_STORAGEpermission in theAndroidManifest.xmlfile.
NOTE
Since the file system is not accessible from the browser, SfPdfViewer.file is not supported on Flutter Web.