Search packages, repositories and app categories

Package detailsv1.0.7

flutter_plugin_pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS

30-day downloads
125
Likes
63
Pub points
40

Install package

flutter pub add flutter_plugin_pdf_viewer

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter plugin designed to display and handle PDF files within mobile applications, supporting both Android and iOS platforms. It provides a straightforward interface for rendering PDFs directly in the app UI, enabling users to view documents without leaving the application. The plugin is lightweight and integrates seamlessly with Flutter's widget system, making it ideal for apps requiring document viewing capabilities.

Use cases

  • Displaying user-generated PDFs
  • Viewing documentation within an app
  • Showing invoices or receipts
  • Reading digital textbooks
  • Rendering scanned documents

Key features

  • Cross-platform support (Android & iOS)
  • Simple integration with Flutter widgets
  • Efficient PDF rendering
  • Supports zoom and scroll
  • Lightweight and fast

Suitable for

  • Mobile apps needing PDF display
  • Educational or e-commerce apps
  • Document management tools
  • Internal business applications
  • Apps with digital content

Considerations

  • Does not support PDF editing
  • Limited to viewing only
  • No built-in search functionality
  • Requires external file access permissions on some devices
  • Performance may vary with large PDFs

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_plugin_pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS

Installation

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

flutter_plugin_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
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.

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package

No data available yet.