Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

A flutter plugin for handling PDF files. Works on both Android & iOS [Delta eBook - Ale]

License

Notifications You must be signed in to change notification settings

BoxColliderDevs/pdf_viewer

Repository files navigation

advance_pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS. Originally forked from (https://github.com/CrossPT/flutter_plugin_pdf_viewer).

Pub Package

Installation

Add advance_pdf_viewer as a dependency in your pubspec.yaml file.

advance_pdf_viewer: any 

Android

No permissions required. Uses application cache directory.

iOS

No permissions required.

How-to:

Load PDF

// Load from assets PDFDocument doc = await PDFDocument.fromAsset('assets/test.pdf'); // Load from URL PDFDocument doc = await PDFDocument.fromURL('http://www.africau.edu/images/default/sample.pdf'); // Load from file File file = File('...'); PDFDocument doc = await PDFDocument.fromFile(file); 

Load pages

// Load specific page PDFPage pageOne = await doc.get(page: _number); 

Pre-built viewer

Use the pre-built PDF Viewer

@override Widget build(BuildContext context){Scaffold( appBar: AppBar( title: Text('Example'), ), body: Center( child: _isLoading ? Center(child: CircularProgressIndicator()) : PDFViewer(document: document)), )} 

This code produces the following view:

Demo Screenshot 1


TODO

  • Allow password-protected files
  • Refactor PDFDocument.getAll() method
  • Increase page resolution
  • Add swipe to change page

Third-party packages used

NameDescription
path_providerA Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.
flutter_cache_managerA CacheManager to download and cache files in the cache directory of the app. Various settings on how long to keep a file can be changed.
numberpickerNumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.
flutter_advanced_networkimageAn advanced image provider provides caching and retrying for flutter app. Now with zoomable widget and transition to image widget.

About

A flutter plugin for handling PDF files. Works on both Android & iOS [Delta eBook - Ale]

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart66.4%
  • Java14.7%
  • Objective-C13.1%
  • Ruby5.8%