PDF Viewer Plus

pdf_viewer_plus is a Flutter package that provides a comprehensive PDF viewer with a collapsible thumbnail sidebar, accessibility support, and intuitive navigation features.

Features

  • Complete PDF Viewer — View PDF documents with smooth page transitions
  • Collapsible Thumbnail Sidebar — Navigate through pages using thumbnails, shown or hidden with a smooth animation
  • Flexible Source Support — Load PDFs from URLs or local assets
  • Double-Tap to Zoom — Double-tap anywhere to zoom in (2.5×) centred on the tap; double-tap again to reset
  • Page Indicator — "current / total" overlay displayed at the bottom of the viewer
  • Keyboard Navigation / arrow keys to change page
  • Resume from any page — Open the document at a specific page with initialPage
  • Page change callback — React to page changes with onPageChanged
  • Accessibility — Full screen reader support (VoiceOver / TalkBack) with customisable semantic labels
  • Customizable Appearance — Sidebar width, thumbnail height, background color, selected page decoration, and more
  • Optimized Performance — PDF data loaded once and shared between viewer and thumbnails

Installation

Add this to your pubspec.yaml:

dependencies:
  pdf_viewer_plus: ^1.0.3

Then run:

flutter pub get

Usage

import 'package:flutter/material.dart';
import 'package:pdf_viewer_plus/pdf_viewer_plus.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('PDF Viewer')),
      body: PdfViewer(
        pdfPath: 'https://example.com/sample.pdf',
        initialPage: 3,
        initialSidebarOpen: true,
        onPageChanged: (page) => print('Now on page $page'),
      ),
    );
  }
}

Customization Options

Parameter Type Default Description
pdfPath String required URL or asset path to the PDF file
initialPage int 1 Page shown when the document first opens
initialSidebarOpen bool false Whether the sidebar is initially open
sidebarWidth double 160 Width of the thumbnail sidebar
thumbnailHeight double 150 Height of each thumbnail
sidebarBackgroundColor Color Colors.grey Background color of the sidebar
selectedPageDecoration BoxDecoration? null Custom decoration for the selected thumbnail
showZoomHint bool true Show the pinch-to-zoom hint animation on first load
showPageIndicator bool true Show the "current / total" page overlay
onPageChanged void Function(int)? null Called whenever the current page changes
semanticLabels PdfSemanticLabels English defaults Labels announced by screen readers

Accessibility

All interactive elements are fully labelled for screen readers. You can override every label by passing a custom PdfSemanticLabels:

PdfViewer(
  pdfPath: '...',
  semanticLabels: PdfSemanticLabels(
    toggleSidebar: 'Afficher / masquer le panneau',
    pageLabel: (page, total) => 'Page $page sur $total',
    zoomHint: 'Pincez pour zoomer',
    loadingDocument: 'Chargement du document…',
    loadingThumbnails: 'Chargement des miniatures…',
    thumbnailList: 'Miniatures des pages',
    loadingThumbnailsError: 'Erreur de chargement des miniatures',
    loadingDocumentError: 'Erreur de chargement du document',
  ),
),

Dependencies

  • pdfx — PDF rendering
  • http — Remote PDF download
  • lottie — Pinch-to-zoom hint animation

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

This package is distributed under the MIT License. See the LICENSE file for more information.


About UserAgents

UserAgents is a company specialized in developing high-quality mobile applications with Flutter using Lean & Agile methodologies. If you need a solution tailored to your requirements, don't hesitate to contact us via email or through our contact form!

We'd be delighted to discuss your projects and support you in your development journey.

Libraries

pdf_viewer
pdf_viewer_plus
A Flutter package for displaying PDF documents with enhanced features.