0 purchases
chakre pdf viewer
chakre_pdf_viewer #
A flutter plugin for handling PDF files. Works on both Android & iOS. Originally forked from https://github.com/anychhoice/pdf_viewer that was Originally forked from https://github.com/lohanidamodar/pdf_viewer that originally forked from https://github.com/CrossPT/flutter_plugin_pdf_viewer.
Installation #
Add chakre_pdf_viewer as a dependency in your pubspec.yaml file.
chakre_pdf_viewer: 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) {
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:
Fixes and changes from advance_pdf_viewer_fork :
Fixed Page Picker
Show Page Picker on dialog
@override
Widget build(BuildContext context) {
Scaffold(
appBar: AppBar(
title: Text('Example'),
),
body: Center(
child: _isLoading
? Center(child: CircularProgressIndicator())
: PDFViewer(
document: document!,
showNavigation: true,
showDialogForPagePicker: true,
),
);
}
copied to clipboard
TODO #
Allow password-protected files
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.