Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erluxman/pdf_flutter
Flutter Widget to display PDF
https://github.com/erluxman/pdf_flutter
Last synced: about 2 months ago
JSON representation
Flutter Widget to display PDF
- Host: GitHub
- URL: https://github.com/erluxman/pdf_flutter
- Owner: erluxman
- License: apache-2.0
- Created: 2020-06-27T16:12:05.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-12T14:55:29.000Z (almost 2 years ago)
- Last Synced: 2024-07-26T22:54:38.225Z (about 2 months ago)
- Language: Dart
- Size: 6.38 MB
- Stars: 100
- Watchers: 5
- Forks: 51
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pdf_flutter
[![pub package](https://img.shields.io/pub/v/pdf_flutter.svg)](https://pub.dartlang.org/packages/pdf_flutter)Inspired by [Pdf_Viewer_Plugin](https://github.com/lubritto/Pdf_Viewer_Plugin) 😇
Wrapped around [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer) on Android. 🙏🏼### 1. Add `pdf_flutter`on `pubspec.yml`
dependencies:
pdf_flutter: ^version### 2. On iOS enable PDF preview like this:
Add this on `ios/Runner/info.plist`:
io.flutter.embedded_views_preview
### 3. Start Using
#### Load PDF from network (caches PDF from network)
PDF.network(
'https://raw.githubusercontent.com/FlutterInThai/Dart-for-Flutter-Sheet-cheet/master/Dart-for-Flutter-Cheat-Sheet.pdf',
height: 500,
width: 300,
maxAndroidZoom: widget.maxAndroidZoom,
midAndroidZoom: widget.midAndroidZoom,
minAndroidZoom: widget.minAndroidZoom,
)
#### Load PDF filesFile fileName;
PDF.file(
fileName,
height: 200,
width: 100,
maxAndroidZoom: widget.maxAndroidZoom,
midAndroidZoom: widget.midAndroidZoom,
minAndroidZoom: widget.minAndroidZoom,
)
#### Load PDF from assetsPDF.assets(
"assets/pdf/demo.pdf",
height: 200,
width: 100,
maxAndroidZoom: widget.maxAndroidZoom,
midAndroidZoom: widget.midAndroidZoom,
minAndroidZoom: widget.minAndroidZoom,
)#### For Production
Here are the steps to fix:
1. Add proguard-rules.pro file if its not already there
2. Inside of the proguard-rules.pro file put this:
-keep class com.shockwave.**
-keepclassmembers class com.shockwave.** { *; }
3.In app/build.gradle add this:shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'## Demo
![demo](art/pdf_flutter_updated.gif)