Search packages, repositories and app categories

GitHub repositoryerluxman/pdf_flutter

pdf_flutter

Flutter Widget to display PDF

pdf_flutter project cover
Stars
98
Forks
50
Last push (UTC)
Oct 12, 2022
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

pdf_flutter

pub package

Inspired by Pdf_Viewer_Plugin 😇 Wrapped around AndroidPdfViewer on Android. 🙏🏼

1. Add pdf_flutteron pubspec.yml
dependencies:
  pdf_flutter: ^version
2. On iOS enable PDF preview like this:

Add this on ios/Runner/info.plist:

    <key>io.flutter.embedded_views_preview</key>
    <true/>
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 files
    File fileName;  
    PDF.file(
        fileName,
        height: 200,
        width: 100,
        maxAndroidZoom: widget.maxAndroidZoom,
        midAndroidZoom: widget.midAndroidZoom,
        minAndroidZoom: widget.minAndroidZoom,
    )
Load PDF from assets
    PDF.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

Laxman Bhattarai GitHub avatar
GitHub author

Laxman Bhattarai ↗

Android & Flutter Developer. Freelancer

FreelancerKathmandu NepalOfficial website ↗
LanguagesDartObjective-CRubyJava

Packages published by this repository

Dependencies used

Dependency list 6 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗