pdf_viewer
一个用于处理 PDF 文件的 Flutter 插件。可在 Android 和 iOS 上运行
- 星标
- 2
- 复刻
- 20
- 最近推送(UTC)
- 2024年4月13日
- 项目状态
- 未归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
advance_pdf_viewer_fork
A flutter plugin for handling PDF files. Works on both Android & iOS. Originally forked from https://github.com/lohanidamodar/pdf_viewer that originally forked from https://github.com/CrossPT/flutter_plugin_pdf_viewer.
Installation
Add advance_pdf_viewer_fork as a dependency in your pubspec.yaml file.
advance_pdf_viewer_fork: 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:
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. |
语言DartJavaObjective-CRuby
使用的依赖
依赖清单 4 项
- flutter
{"sdk":"flutter"} - flutter_cache_manager
^3.1.1 - numberpicker
^2.1.1 - path_provider
^2.0.2
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗