Skip to content
pubscout

flutter_pdfview

1.4.5, released 4 months ago by an unverified publisher

A Flutter plugin providing native PDFView widgets on Android and iOS.

WASM-ready
$ flutter pub add flutter_pdfview
Source repository

What it does

It renders PDF files natively on Android and iOS devices using a dedicated PDFView widget. It offers controller options for pagination, zooming, page sizing, and screenshots, as well as various callbacks for rendering and page changes.

AI-written summary of version 1.4.5, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display local or data-driven PDF files inside your Flutter app on Android and iOS.
  • You require native rendering performance for documents using platform-specific viewers.

Skip it when

  • You need web, macOS, Windows, or Linux support (currently not supported by this package).
  • You need to implement advanced PDF text searching within the view.

Strengths

  • Uses native platform PDF renderers (AndroidPdfViewer and PDFKit).
  • Provides a robust controller for programmatic navigation, zooming, and screenshots.
  • Supports customizable options like night mode, swipe directions, and fit policies.

Weaknesses

  • Only supports Android and iOS platforms currently.
  • Platform views on Android can occasionally introduce layout constraints or require hybrid composition considerations.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Requires minimum Flutter 3.32.0 / Dart 3.8.0. iOS requires support > 12.0.

PDFView(
  filePath: path,
  enableSwipe: true,
  swipeHorizontal: true,
  autoSpacing: false,
  pageFling: false,
  showScrollIndicators: true,
  backgroundColor: Colors.grey,
  onRender: (_pages) {
    setState(() {
      pages = _pages;
      isReady = true;
    });
  },
  onError: (error) {
    print(error.toString());
  },
  onPageError: (page, error) {
    print('$page: ${error.toString()}');
  },
  onViewCreated: (PDFViewController pdfViewController) {
    _controller.complete(pdfViewController);
  },
  onPageChanged: (int page, int total) {
    print('page change: $page/$total');
  },
  onLoadComplete: (int? pages) {
    print('# of pages: $pages');
  },
)

Alternatives

Packages that do the same job and could replace flutter_pdfview.

Works with

Packages commonly used together with flutter_pdfview: ones it builds on, ones built on it, and its own family.