advance_pdf_viewer2 2.0.5+1 copy "advance_pdf_viewer2: ^2.0.5+1" to clipboard
advance_pdf_viewer2: ^2.0.5+1 copied to clipboard

A fork from a flutter plugin for handling PDF files. Works on both Android, iOS ( MacOS under testing )

advance_pdf_viewer2 #

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

Update #

Macos support currently under testing

Pub Package

Installation #

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

advance_pdf_viewer2: any
copied to clipboard

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);
copied to clipboard

Load pages

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

Pre-built viewer

Use the pre-built PDF Viewer

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

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

Name Description
path_provider A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.
flutter_cache_manager A 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.
numberpicker NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.
flutter_advanced_networkimage An advanced image provider provides caching and retrying for flutter app. Now with zoomable widget and transition to image widget.
18
likes
130
points
249
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.08 - 2025.03.23

A fork from a flutter plugin for handling PDF files. Works on both Android, iOS ( MacOS under testing )

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_cache_manager, numberpicker, path_provider

More

Packages that depend on advance_pdf_viewer2