A full-featured PDF viewer for Flutter (Android & iOS) with annotations, bookmarks, DRM protection, search, thumbnails, auto-scroll, and dark/light theme support. Built on PDFium via pdfrx.
| Android | iOS |
|---|---|
| ✅ | ✅ |
- 📄 High-performance PDF rendering using PDFium FFI (pdfrx)
- 🔖 Bookmarks — add, remove, navigate, sync with server
- ✏️ Annotations — pen drawing, highlighter, notes, eraser with undo/redo
- 🔤 Text Selection — select and copy PDF text
- 🔍 Search — full-text search with match highlighting
- 🖼️ Thumbnails — page thumbnail grid drawer
- 📒 Table of Contents — hierarchical PDF outline navigation
- 🌙 Dark/Light theme support
↔️ Scroll direction — toggle vertical/horizontal scroll- ⏩ Auto-scroll with configurable interval
- 📊 Page slider — bottom navigation bar with page preview
- 🔒 DRM protection — screenshot/screen-recording prevention
- ☀️ Keep screen on while reading
- 📊 Session tracking — reading duration and page progress
- 🔗 Authenticated downloads via custom HTTP headers
- ☁️ Server sync via callbacks (bookmarks, annotations, sessions)
- 💾 Custom storage — pluggable storage backend
- 📤 Share — share PDF or content
- 🪶 SimplePdfViewer — lightweight view-only widget for invoices/docs
dependencies:
pdf_viewer_pro: ^0.0.2import 'package:pdf_viewer_pro/pdf_viewer_pro.dart';
// Open from file path
Navigator.push(context, MaterialPageRoute(
builder: (_) => PdfViewerScreen(
filePath: '/path/to/document.pdf',
title: 'My Document',
),
));
// Open from URL
Navigator.push(context, MaterialPageRoute(
builder: (_) => PdfViewerScreen(
fileUrl: 'https://example.com/document.pdf',
title: 'My Document',
),
));PdfViewerScreen(
filePath: '/path/to/document.pdf',
title: 'My Document',
bookId: 42, // For bookmarks/annotations persistence
featureConfig: PdfViewerFeatureConfig(
enableBookmarks: true,
enableAnnotations: true,
enableSearch: true,
enableTextSelection: true,
enableThumbnails: true,
enableTableOfContents: true,
enableAutoScroll: true,
enableDarkModeToggle: true,
enableFullscreen: true,
enablePageSlider: true,
enableScreenProtection: false,
enableKeepScreenOn: true,
enableSessionTracking: true,
enableScrollDirectionToggle: true,
enableSettings: true,
enableShare: true,
),
);// All features enabled
featureConfig: PdfViewerFeatureConfig.fullFeatures
// View-only (no annotations/bookmarks)
featureConfig: PdfViewerFeatureConfig.readOnly
// Bare minimum (page slider only)
featureConfig: PdfViewerFeatureConfig.minimalFor invoices, receipts, and documents that only need viewing:
// From file path
SimplePdfViewer.file('/path/to/invoice.pdf')
// From bytes
SimplePdfViewer.data(pdfBytes, sourceName: 'invoice.pdf')
// From URL
SimplePdfViewer.uri(Uri.parse('https://example.com/doc.pdf'))themeConfig: PdfViewerThemeConfig(
primaryColor: Colors.blue,
lightBackgroundColor: Colors.white,
darkBackgroundColor: Color(0xFF121212),
cardBorderRadius: 12.0,
),serviceConfig: PdfViewerServiceConfig(
// Sync bookmarks with your server
onBookmarksSync: (bookId, bookmarks) async {
await myApi.saveBookmarks(bookId, bookmarks);
},
onBookmarksLoad: (bookId) async {
return await myApi.loadBookmarks(bookId);
},
// Track reading sessions
onSessionStart: (bookId) async {
await myApi.startSession(bookId);
},
onSessionEnd: (bookId, durationSeconds, currentPage, totalPages) async {
await myApi.endSession(bookId, durationSeconds);
},
// Authenticated file access
httpHeaders: {'Authorization': 'Bearer $token'},
),