PDF view for Flutter

Overview

flutter_pdfview

Native PDF View for iOS and Android

xscode Latest compatibility result for Stable channel Latest compatibility result for Beta channel Latest compatibility result for Dev channel

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_pdfview: ^1.2.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_pdfview/flutter_pdfview.dart';

Options

Name Android iOS Default
defaultPage 0
onViewCreated null
onRender null
onPageChanged null
onError null
onPageError null
onLinkHandle null
gestureRecognizers null
filePath
pdfData
fitPolicy FitPolicy.WIDTH
enableSwipe true
swipeHorizontal false
password null
nightMode false
password null
autoSpacing true
pageFling true
pageSnap true
preventLinkNavigation false

Controller Options

Name Description Parameters Return
getPageCount Get total page count - Future<int>
getCurrentPage Get current page - Future<int>
setPage Go to/Set page int page Future<bool>

Example

PDFView(
  filePath: path,
  enableSwipe: true,
  swipeHorizontal: true,
  autoSpacing: false,
  pageFling: false,
  onRender: (_pages) {
    setState(() {
      pages = _pages;
      isReady = true;
    });
  },
  onError: (error) {
    print(error.toString());
  },
  onPageError: (page, error) {
    print('$page: ${error.toString()}');
  },
  onViewCreated: (PDFViewController pdfViewController) {
    _controller.complete(pdfViewController);
  },
  onPageChanged: (int page, int total) {
    print('page change: $page/$total');
  },
),

Dependencies

Android

AndroidPdfViewer

iOS (only support> 11.0)

PDFKit

Future plans

  • Replace barteksc/AndroidPdfViewer with MuPDF or Android Native PDF Renderer.
  • Improve documentation
  • Support other platforms such as MacOS, Windows, Linux and Web
  • Add search functionality
  • Improve performance on zooming, page changing
  • Improve image quality
  • Write more test

Support

Buy Me A Coffee

Donate with PayPal button

Developer

Comments
  • JNI DETECTED ERROR IN APPLICATION: java_class == null

    JNI DETECTED ERROR IN APPLICATION: java_class == null

    Hello guys, i'm facing an application crush on Android devices whenever Pdf screen starts only in release version. I looked up in the Logcat and found this error:

    12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: java_class == null 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] in call to GetMethodID 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] from com.shockwave.pdfium.b.a com.shockwave.pdfium.PdfiumCore.nativeGetPageSizeByIndex(long, int, int) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] "AsyncTask #6" prio=5 tid=25 Runnable 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x12f432e0 self=0x5583b064e0 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | sysTid=29637 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x7f6a26f450 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 40724999 342552 21 ) utm=4 stm=0 core=5 HZ=100 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | stack=0x7f6a16d000-0x7f6a16f000 stackSize=1037KB 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator lock"(shared held) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #00 pc 000000000048b870 /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+200) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #01 pc 000000000045a620 /system/lib64/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+224) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #02 pc 000000000030ea74 /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1004) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #03 pc 000000000030f448 /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #04 pc 000000000035a7d0 /system/lib64/libart.so (_ZN3art3JNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6_+1048) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #05 pc 0000000000004620 /data/app/com.dmn.digitalkiosk-1/lib/arm64/libjniPdfium.so (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex+328) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #06 pc 00000000005ca9f4 /data/app/com.dmn.digitalkiosk-1/oat/arm64/base.odex (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex__JII+152) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at com.shockwave.pdfium.PdfiumCore.nativeGetPageSizeByIndex(Native method) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at com.shockwave.pdfium.PdfiumCore.b(:-1) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] - locked <0x072a7c88> (a java.lang.Object) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.g.c(:-1) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.g.<init>(:-1) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.c.a(:-1) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.c.doInBackground(:-1) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at android.os.AsyncTask$2.call(AsyncTask.java:295) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.FutureTask.run(FutureTask.java:237) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Thread.run(Thread.java:818) 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/runtime.cc:368] Runtime aborting... 12-03 21:06:08.034 29544-29637/? A/art: art/runtime/runtime.cc:368] 12-03 21:06:08.034 29544-29637/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 29637 (AsyncTask #6) 12-03 21:06:08.094 607-607/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 12-03 21:06:08.094 607-607/? A/DEBUG: Build fingerprint: 'samsung/c7ltezh/c7ltechn:6.0.1/MMB29M/C7000ZHU2APJ2:user/release-keys' 12-03 21:06:08.094 607-607/? A/DEBUG: Revision: '4' 12-03 21:06:08.094 607-607/? A/DEBUG: ABI: 'arm64' 12-03 21:06:08.094 607-607/? A/DEBUG: pid: 29544, tid: 29637, name: AsyncTask #6 >>> com.dmn.digitalkiosk <<< 12-03 21:06:08.094 607-607/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 12-03 21:06:08.124 607-607/? A/DEBUG: Abort message: 'art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: java_class == null' 12-03 21:06:08.124 607-607/? A/DEBUG: x0 0000000000000000 x1 00000000000073c5 x2 0000000000000006 x3 0000000000000000 12-03 21:06:08.124 607-607/? A/DEBUG: x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000000000000000 12-03 21:06:08.124 607-607/? A/DEBUG: x8 0000000000000083 x9 0000007f8a983a70 x10 0000000000000003 x11 0000000000000140 12-03 21:06:08.124 607-607/? A/DEBUG: x12 0000005583e2f6f0 x13 0000005582ed3000 x14 0000000000000000 x15 00000000fffffff2 12-03 21:06:08.124 607-607/? A/DEBUG: x16 0000007f8a97c6a8 x17 0000007f8a93ec6c x18 0000000000000000 x19 0000007f6a26f510 12-03 21:06:08.124 607-607/? A/DEBUG: x20 0000007f6a26f450 x21 0000000000000003 x22 0000000000000006 x23 0000005583a13fc0 12-03 21:06:08.124 607-607/? A/DEBUG: x24 0000007f870191d0 x25 0000005583b064e0 x26 0000005582ee7530 x27 0000000000000001 12-03 21:06:08.124 607-607/? A/DEBUG: x28 0000005583e7ecf0 x29 0000007f6a26e510 x30 0000007f8a93c408 12-03 21:06:08.124 607-607/? A/DEBUG: sp 0000007f6a26e510 pc 0000007f8a93ec74 pstate 0000000020000000 12-03 21:06:08.124 607-607/? A/DEBUG: backtrace: 12-03 21:06:08.124 607-607/? A/DEBUG: #00 pc 000000000006ac74 /system/lib64/libc.so (tgkill+8) 12-03 21:06:08.124 607-607/? A/DEBUG: #01 pc 0000000000068404 /system/lib64/libc.so (pthread_kill+68) 12-03 21:06:08.124 607-607/? A/DEBUG: #02 pc 0000000000021328 /system/lib64/libc.so (raise+28) 12-03 21:06:08.124 607-607/? A/DEBUG: #03 pc 000000000001bc58 /system/lib64/libc.so (abort+60) 12-03 21:06:08.124 607-607/? A/DEBUG: #04 pc 0000000000431978 /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+304) 12-03 21:06:08.124 607-607/? A/DEBUG: #05 pc 00000000001373e4 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136) 12-03 21:06:08.124 607-607/? A/DEBUG: #06 pc 000000000030eeac /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+2084) 12-03 21:06:08.124 607-607/? A/DEBUG: #07 pc 000000000030f448 /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224) 12-03 21:06:08.124 607-607/? A/DEBUG: #08 pc 000000000035a7d0 /system/lib64/libart.so (_ZN3art3JNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6_+1048) 12-03 21:06:08.124 607-607/? A/DEBUG: #09 pc 0000000000004620 /data/app/com.dmn.digitalkiosk-1/lib/arm64/libjniPdfium.so (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex+328) 12-03 21:06:08.124 607-607/? A/DEBUG: #10 pc 00000000005ca9f4 /data/app/com.dmn.digitalkiosk-1/oat/arm64/base.odex (offset 0x3ca000)

    can you please tell me how to fix this issue..

    opened by tayseer9 14
  • background color

    background color

    when i not use pdfview Colors.green is working

    Center(
                child: Container(
                  color: Colors.green,
                  height: MediaQuery.of(context).size.height * 0.75,
                  width: MediaQuery.of(context).size.width,
    

    When i use Pdfview Colors.green is not working :/

    Center(
                child: Container(
                  color: Colors.green,
                  height: MediaQuery.of(context).size.height * 0.75,
                  width: MediaQuery.of(context).size.width,
                  child: PDFView(
                    filePath: widget.pathblack,
                    enableSwipe: true,
                    swipeHorizontal: true,
                    autoSpacing: true,
    
                    pageFling: true,
                    pageSnap: true,
                    defaultPage: currentPage,
                    fitPolicy: FitPolicy.BOTH,
    
                    preventLinkNavigation:
                        true, // if set to true the link is handled in flutter
                    onRender: (_pages) {
                      setState(() {
                        pages = _pages;
                        isReady = true;
                      });
                    },
                    fitEachPage: true,
                    onError: (error) {
                      setState(() {
                        errorMessage = error.toString();
                      });
                      print(error.toString());
                    },
                    onPageError: (page, error) {
                      setState(() {
                        errorMessage = '$page: ${error.toString()}';
                      });
                      print('$page: ${error.toString()}');
                    },
                    onViewCreated: (PDFViewController pdfViewController) {
                      _controller.complete(pdfViewController);
                    },
                    onLinkHandler: (String uri) {
                      print('goto uri: $uri');
                    },
                    onPageChanged: (int page, int total) {
                      print('page change: $page/$total');
    
                      setState(() {
                        currentPage = page;
                      });
                    },
                  ),
                ),
              ),
    

    Could you help me ?

    opened by sahmirzali 10
  • Problem on playstore downloaded apk

    Problem on playstore downloaded apk

    @endigo I am not doing much complex stuff only reading the pdf and displaying. It works fine in all mode debug and profile, release but when i deployed it on playstore, it crashes.

    In your readme.md you said if using proguard then add line:- -keep class com.shockwave.**,. my project doesn't contains proguard, so in build .gradle file

    `rdef localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

    def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

    def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

    def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }

    def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) }

    apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.google.gms.google-services' //apply plugin: 'com.android.library'

    android { compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }
    
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "<app package name>"
        multiDexEnabled true
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    
    buildTypes {
        release {
            signingConfig signingConfigs.release
            useProguard false
        }
    }
    

    }

    flutter { source '../..' }

    dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-analytics:17.2.2' implementation 'com.android.support:multidex:1.0.3' implementation 'com.google.firebase:firebase-messaging:20.2.0'

    } `

    also i have only one screen and its job is to display pdf, here it is

    `@override Widget build(BuildContext context) { if(widget.path != null && widget.path.compareTo("@") == 0) //... it can only happen when file doesn't exists and neither the internet connection Navigator.of(context).pop(); return Scaffold( backgroundColor: Theme.of(context).backgroundColor, body: (widget.path == null) ? getLoading() : Stack( children: [ PDFView( filePath: widget.path, autoSpacing: true, enableSwipe: true, pageSnap: true, swipeHorizontal: true, nightMode: MyAppState.darkTheme, onError: (e) { print(e); }, onRender: (_pages) { setState(() { pdfReady = true; }); }, onViewCreated: (PDFViewController vc) { _pdfViewController = vc; }, onPageChanged: (int page, int total) { setState(() {}); }, onPageError: (page, e) {}, ),

              ],
            ),
    );
    

    }`

    and this is the error i got from play console:-


    pid: 0, tid: 0 >>> <<<

    backtrace: #00 pc 00000000000220ec /system/lib64/libc.so (abort+116) #01 pc 0000000000465c98 /system/lib64/libart.so (art::Runtime::Abort(char const*)+1196) #02 pc 0000000000008ce0 /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+724) #03 pc 00000000002e5ec8 /system/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1640) #04 pc 0000000000332cd8 /system/lib64/libart.so (art::JNI::GetMethodID(_JNIEnv*, _jclass*, char const*, char const*)+1464) #05 pc 0000000000004620 /data/app/ --g9v7l0jhzEj_95rtekdOg==/split_config.arm64_v8a.apk (offset 0xfd3000) (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex+328) #06 pc 0000000000000704 /data/app/--g9v7l0jhzEj_95rtekdOg==/oat/arm64/base.odex (offset 0x1a000)

    I tested the app with flutter run --release on a device, then published the appbundle generated from flutter build appbundle --release, i guess it might be the problem with splitted apks as you can see i have bolded in above error from play console,.. i would really appreciate a help please

    need more information 
    opened by raunak-many-ac 8
  • PDF file not opening

    PDF file not opening

    PDF file is only opening in emulator of Android Studio. And then when I release it and install on my phone, its not opening. Whats the problem?

    Edit: It worked after I obfuscate the flutter app and added the line told by this package to proguard. Thank You.

    opened by TAMU73 8
  • Fixed the Initial Zoom bug in IOS

    Fixed the Initial Zoom bug in IOS

    Hello ❤

    There are three open issues reporting a bug causing an initial zoom at the PDF document in IOS, here is the link of the issues 😢:

    https://github.com/endigo/flutter_pdfview/issues/117, https://github.com/endigo/flutter_pdfview/issues/150, and https://github.com/endigo/flutter_pdfview/issues/166

    I was also facing the same bug but I wanted to give my self a try to solve it and thanks god! I did it after hours of trial 💪🏻

    This answer in Stack Overflow actually helped me a lot, so big thanks goes to @Nicholas Farmer

    Kindly review the solution, I hope you like it.

    Thanks ❤ Moaz El-sawaf

    opened by moazelsawaf 7
  • Links inside pdf crashes the app when tapped

    Links inside pdf crashes the app when tapped

    I just put a link inside a pdf it works fine on desktop, but in my app these links just crashes the application with following errors:-

    Screenshot_2020-07-07-09-31-07-419_com google android apps playconsole

    Screenshot_2020-07-07-09-31-58-015_com google android apps playconsole

    Sir its my humble request., please help because links are crucial part of documents...

    opened by raunak-many-ac 7
  • IOS build Error

    IOS build Error

    My app is working OK without flutter_pdfview plugin.

    With flutter_pdfview, it does not build and run on IOS.

    It gives following error on Android Studio run :

    /Users/olzii/Desktop/prj/docapp/ios/Runner/GeneratedPluginRegistrant.m:46:9: fatal error: module 'flutter_pdfview' not found
    @import flutter_pdfview;
     ~~~~~~~^~~~~~~~~~~~~~~
    

    Could not build the precompiled application for the device.

    on XCode build it gives following error :

    image

    image

    I have tested your EXAMPLE app, it built and run without any problem. What i have done wrong, please help ?

    I have searched from Google and made Target Membership to PUBLIC. I it did not help. image

    Info.plist config : image

    opened by olzii 7
  • Duplicate Classes in Dependencies

    Duplicate Classes in Dependencies

    Dear Sir, this package may have a class name clash with another package:

    auto_size_text: ^1.1.2 cupertino_icons: ^0.1.2 flutter_pdfview: ^1.0.0+6 flutter_swiper: ^1.1.6 flutter_webview_plugin: ^0.3.5 flutter_xlider: ^2.4.3 folding_cell: ^0.1.2 font_awesome_flutter: ^8.4.0 http: ^0.12.0+2 intl: ^0.15.8 path_provider: ^1.1.0 pull_to_refresh: ^1.3.7 rxdart: ^0.22.0 scoped_model: ^1.0.1 shared_preferences: ^0.5.2 table_calendar: ^1.2.2 vector_math: ^2.0.8

    C:\Users\Ted\DEV\swan>flutter doctor -v [√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17134.765], locale en-US) • Flutter version 1.5.4-hotfix.2 at C:\flutter • Framework revision 7a4c33425d (5 weeks ago), 2019-04-29 11:05:24 -0700 • Engine revision 52c7a1e849 • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

    [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at C:\Users\Ted\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01) • All Android licenses accepted.

    [√] Android Studio (version 3.4) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 35.3.1 • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

    [√] VS Code (version 1.34.0) • VS Code at C:\Users\Ted\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.0.2

    [√] Connected device (1 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

    • No issues found!

    C:\Users\Ted\DEV\swan>flutter run --debug Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib/main.dart on Android SDK built for x86 in debug mode... Initializing gradle... 0.8s Resolving dependencies... 2.7s D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\17.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\20.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\22.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\37.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\60.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\65.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\70.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\75.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\80.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\85.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\90.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\95.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\100.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\105.jar, C:\Users\Ted\DEV\swan\build\app\intermediates\transforms\dexBuilder\debug\110.jar Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 6s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 7.0s


    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See https://goo.gl/CP92wY for more information on the problem and how to fix it.


    Gradle task assembleDebug failed with exit code 1

    need more information 
    opened by tedchuang 7
  • Add support for reading PDF from byte data

    Add support for reading PDF from byte data

    You can provide the actual byte data instead of the filename when you create the PDFView. This made it necessary to remove the @required attribute but an extra assert checks if either a path or the data is provided.

    There is one small unrelated change, an error message still referred to the original webview plugin you got the boilerplate from. :-)

    opened by deakjahn 6
  • FileNotFoundException: EACCES (Permission denied)

    FileNotFoundException: EACCES (Permission denied)

    Getting this error on android on Android. FileNotFoundException: EACCES (Permission denied) Getting this error so many times while viewing pdf. Some pdf are loading very rarely

    my-code :: Basically almost the same code as 2

    opened by yskhs07 5
  • Crashing in release build

    Crashing in release build

    [✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.2 19C57, locale en-IN) • Flutter version 1.17.5 at /usr/local/flutter • Framework revision 8af6b2f038 (2 weeks ago), 2020-06-30 12:53:55 -0700 • Engine revision ee76268252 • Dart version 2.8.4

    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/nishanth/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.9.1

    [✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

    [!] IntelliJ IDEA Community Edition (version 2020.1.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • For information about installing plugins, see https://flutter.dev/intellij-setup/#installing-the-plugins

    [✓] VS Code (version 1.46.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.11.0

    [✓] Connected device (1 available) • POCO F1 • 2a1d55d8 • android-arm64 • Android 10 (API 29)

    opened by nishanthrk 5
  •  PDF is not visible in API Level 31 (Android 12) version.

    PDF is not visible in API Level 31 (Android 12) version.

    Thank you for your package.
    We are developing an app that creates and displays pdfs directly with the pdf package. When this app is run, it creates a 'pdf' by default.
    When the app runs, the default 'pdf' is shown on the screen, but it is not shown in the android 12 version.
    I am using version 1.2.2 of flutter_pdfview. Looking at the change log, I saw that I updated compileSdkVersion to 30.
    However, if the user changes the settings of pdf, the pdf is created again, updated, and displayed on the screen. However, the pdf is updated only in debug mode and in release mode, the pdf is updated only when there is an action such as changing the page.

    Is there a way to show pdf initially in android 12 version and also update pdfView if you update pdfData in release mode?? I am attaching the code below.

    PDFView(
                key: ValueKey(context.read<PDFProvider>().keyCount),
                pdfData: context.watch<PDFProvider>().uinPdfData!,
                enableSwipe: true,
                swipeHorizontal: true,
                autoSpacing: false,
                pageFling: false,
                defaultPage: 0,
                onRender: (_pages) {
                  setState(() {
                    isReady = true;
                  });
                },
                onError: (error) {
                  print(error.toString());
                },
                onPageError: (page, error) {
                  print('$page: ${error.toString()}');
                },
                onPageChanged: (int? page, int? total) {
                  setState(() {
                    nPageIndex = page! + 1;
                    context.read<PDFProvider>().setTotalStffNum(total!);
                  });
                },
              ),
    

    Thanks for your help.

    opened by shinxxxxwon 1
  • Problem on iOS with BackdropFilter and ColorFIltered

    Problem on iOS with BackdropFilter and ColorFIltered

    I am trying to change colors on PdfView, on Android it works correct, but on iOS it's just make solid color under the PdfView without changing real colors inside the Widget. And When I am calling bottomSheet under the PdfView with BackdropFilter to make blur effect, there is no any blur effect, only under the PdfView. Other parts of the screen are blurred

    opened by zatovagul 1
  • Release version not working

    Release version not working

    When I run debug build this library works without any problems. When I run release build on Android, PdfView not working, but there is no any logs. I tried also flutter run --release -v, and I didn't noticed any errors with PdfView problem.

    Do you know how to fix it?

    opened by zatovagul 0
  • iOS onError is never called

    iOS onError is never called

    PDFView(
      filePath: "test",
      autoSpacing: false,
      pageSnap: false,
      pageFling: false,
      onError: (dynamic error) {
        print("not called");
      },
    );
    

    onError is never call on iOS.

    flutter_pdfview: 1.2.5

    [✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-arm, locale fr-FR)
        • Flutter version 3.3.4 on channel stable at /Users/earminjon/fvm/versions/3.3.4
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision eb6d86ee27 (4 weeks ago), 2022-10-04 22:31:45 -0700
        • Engine revision c08d7d5efc
        • Dart version 2.18.2
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
        • Android SDK at /Users/earminjon/Library/Android/Sdk
        • Platform android-33, build-tools 33.0.0
        • ANDROID_HOME = /Users/earminjon/Library/Android/Sdk
        • Java binary at: /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14A400
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
        • IntelliJ at /Users/earminjon/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
        • Flutter plugin version 71.0.5
        • Dart plugin version 222.4345.14
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
        • IntelliJ at /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ IDEA.app
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
    
    [✓] Connected device (3 available)
        • iPhone 11 Pro Max (mobile) • 20978832-C147-4475-92C9-30CEBE150DF3 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
        • macOS (desktop)            • macos                                • darwin-arm64   • macOS 12.6 21G115 darwin-arm
        • Chrome (web)               • chrome                               • web-javascript • Google Chrome 107.0.5304.87
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    opened by EArminjon 1
  • Execution failed for task ':app:checkDebugDuplicateClasses'.

    Execution failed for task ':app:checkDebugDuplicateClasses'.

    Hello,

    I encounter this error which disables the flutter_pdfview plugin: ^1.2.1 until flutter_pdfview version: ^1.2.5

    It started when I wanted to upgrade from 1.2.1 to 1.2.5 Going back to 1.2.1 didn't change anything. I deleted .pub-cache performed flutter clean

    I don't use XCode except AS and my mobile only project is Android only.

    Any compilation fails. I have to disable the plugin in my project to be able to debug my works.

    An idea ?

    `[✓] Flutter (Channel stable, 3.3.3, on macOS 12.6 21G115 darwin-x64, locale fr-FR) • Flutter version 3.3.3 on channel stable at /Users/stephanecouget/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18a827f393 (il y a 6 jours), 2022-09-28 10:03:14 -0700 • Engine revision 5c984c26eb • Dart version 2.18.2 • DevTools version 2.15.0

    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1) • Android SDK at /Users/stephanecouget/Library/Android/sdk • Platform android-33, build-tools 33.0.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.

    [!] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 ! CocoaPods 1.9.3 out of date (1.11.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

    [✓] VS Code (version 1.69.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0

    [✓] Connected device (3 available) • SM T970 (mobile) • R52R40AJJ6R • android-arm64 • Android 12 (API 32) • macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.91

    [✓] HTTP Host Availability • All required HTTP hosts are available

    ! Doctor found issues in 1 category. `

    ------------------------ FAILURE

    FAILURE: Build failed with an exception. [ ] * What went wrong: [ ] Execution failed for task ':app:checkDebugDuplicateClasses'. [ ] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable [ ] > Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.8.0-runtime (androidx.core:core:1.8.0) and support-compat-27.1.1-runtime(com.android.support:support-compat:27.1.1)`

    failure.pdf

    Best regards,

    opened by stephane-couget 0
Flutter list view - An unofficial list view for flutter

Flutter List View I don't like official list view. There are some features don't

null 24 Dec 15, 2022
Grid-View-App - Grid View App For Flutter

grid_view_app practice purpose flutter application Getting Started This project

Md Tarequl Islam 4 Jun 9, 2022
Swipeable button view - Create Ripple Animated Pages With Swipeable Button View

swipeable_button_view You can create ripple animated pages with swipeable_button

cemreonur 3 Apr 22, 2022
-UNDER DEVELOPMENT- a project built demonstrating model view view model architecture

mvvm_project A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Atuoha Anthony 4 Nov 28, 2022
Bac-App-Flutter - Flutter application where you can read PDF locally or by internet and is saved

Bac App - Flutter Flutter application where you can read PDF locally or by inter

Chakib Ammar Aouchiche 3 Jun 7, 2022
A flutter plugin for viewing PDF files in mobile app (Android & iOS)

PDF Viewer (JK) A flutter plugin for viewing PDF files in mobile app (Android & iOS) Pub.dev https://pub.dev/packages/pdf_viewer_jk Github ht

Jawad 8 Sep 30, 2021
A flutter plugin for handling PDF files

advance_pdf_viewer A flutter plugin for handling PDF files. Works on both Android & iOS. Originally forked from (https://github.com/CrossPT/flutter_pl

Abeer Iqbal 0 Dec 3, 2021
Pdf creation module for dart/flutter

Pdf for Dart and Flutter This set of plugins allows Flutter apps to generate and print pdf files to the device printer. This plugin works for iOS and

David PHAM-VAN 954 Jan 3, 2023
Flutter agenda - Flutter Agenda View Package (pub.dev)

Flutter Agenda View Agenda Widget Package for Flutter Features Image Video Recor

Iliyass Zamouri 3 Apr 15, 2022
A periodic table app with 3D view of the elements built using flutter.

A flutter app which takes you on a 3d visualisation of the 118 elements of the periodic table. promo.mp4 Tech Stack Deployed using How it all began It

Shanwill Pinto 48 Nov 16, 2022
Flutter Split View and Drawer Navigation example

Flutter Split View and Drawer Navigation example This repo contains the source code for this tutorial: Responsive layouts in Flutter: Split View and D

Andrea Bizzotto 32 Nov 17, 2022
Flutter Insert, Update, Delete and add form view dynamic

salesapp Insert, Update, Delete and form view add dynamic. Getting Started This project is a starting point for a Flutter application. A few resources

null 1 Dec 22, 2021
A flutter list view which can drag & move item to change order.

draggable_flutter_list A flutter list view which can drag & move item to change order. some codes come from flutter_list_drag_and_drop fix flutter_lis

刘彦博 40 Sep 22, 2022
Search and view popular Youtube videos with Youtube API in Flutter App

getx_bottom_nav_sample The sample of AnimatedBottomNavBar with GetX 주요 Package 설명 1.url_launcher url_launcher pub.dev flutter 에서 인앱, 외부 브라우저로 연길 시켜 주는

Jacob Ko 1 Dec 25, 2021
A Flutter package for paginating a list view

paging A Flutter package for paginating a list view Installation Add this to your package's pubspec.yaml file dependencies: ... paging: ^latest.ve

Joshua Matta 36 Dec 12, 2022
A Food App using Flutter & Firebase to post and view food blogs along with their recipes.

A Food App using Flutter ?? & Firebase ?? About the App ?? FoodLab is a App to post and view food blogs along with their recipes if you want ?? ! Logi

Shivani Singh 170 Dec 24, 2022
Embeddable unity game engine view for Flutter.

flutter_unity_widget Flutter unity 3D widget for embedding unity in flutter. Now you can make awesome gamified features of your app in Unity and get i

Rex Raphael 1.7k Jan 8, 2023
A WEB 3 Exploration Flutter APP that let you view NFTS

It is simply a WEB 3 Exploration APP that let you view NFTS (News about web 3 ar

null 11 Nov 22, 2022
A section list view for flutter

Section view Features Show with select view Alphabet support Refresh support Scr

null 6 Nov 6, 2022