[] A fast PDF reader component for Android development

Overview

This project is no longer maintained.

You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PDF files, allowing it to use the Apache License 2.0 which gives you much more freedom.


Android Arsenal

Screenshot of the sample app

Android PDFView is a library which provides a fast PDFView component for Android, with animations, gestures, and zoom. It's based on VuDroid for decoding the PDF file.

Get it

Android PDFView is available in Maven Central.

<dependency>
	<groupId>com.joanzapata.pdfview</groupId>
	<artifactId>android-pdfview</artifactId>
	<version>1.0.4</version>
	<type>apklib</type>
</dependency>

Or via gradle:

compile 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'

Include PDFView in your layout

<com.joanzapata.pdfview.PDFView
        android:id="@+id/pdfview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

Load a PDF file

pdfView.fromAsset(pdfName)
    .pages(0, 2, 1, 3, 3, 3)
    .defaultPage(1)
    .showMinimap(false)
    .enableSwipe(true)
    .onDraw(onDrawListener)
    .onLoad(onLoadCompleteListener)
    .onPageChange(onPageChangeListener)
    .load();
  • pages is optional, it allows you to filter and order the pages of the PDF as you need
  • onDraw is also optional, and allows you to draw something on a provided canvas, above the current page

License

Copyright 2013-2015 Joan Zapata

This file is part of Android-pdfview.

Android-pdfview is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Android-pdfview is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Android-pdfview.  If not, see <http://www.gnu.org/licenses/>.
Comments
  • Crash on document load

    Crash on document load

    E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
        Process: it.programmatica.reader, PID: 4942
        java.lang.RuntimeException: An error occured while executing doInBackground()
                at android.os.AsyncTask$3.done(AsyncTask.java:300)
                at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                at java.lang.Thread.run(Thread.java:841)
         Caused by: java.lang.UnsatisfiedLinkError: Couldn't load vudroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/it.programmatica.reader-2.apk"],nativeLibraryDirectories=[/data/app-lib/it.programmatica.reader-2, /vendor/lib, /system/lib]]]: findLibrary returned null
                at java.lang.Runtime.loadLibrary(Runtime.java:358)
                at java.lang.System.loadLibrary(System.java:526)
                at org.vudroid.core.VuDroidLibraryLoader.load(VuDroidLibraryLoader.java:13)
                at org.vudroid.pdfdroid.codec.PdfContext.<clinit>(PdfContext.java:13)
                at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:50)
                at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31)
                at android.os.AsyncTask$2.call(AsyncTask.java:288)
                at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                at java.lang.Thread.run(Thread.java:841)
    
    

    thanks

    opened by mediazard 12
  • PDF rendering issues

    PDF rendering issues

    Hi Joan,

    first of all - thank you for this great library.

    I have an issue with the PDF rendering when I zoom in.

    Please take a look at the attached screenshot.

    Do you have an idea why this problem occurs?

    screenshot_2014-07-03-10-35-56

    opened by mpociot 11
  • Set orientation of the pdf

    Set orientation of the pdf

    horizontal Right now, some pdfs are displayed in portrait mode while the device is in landscape (see image). I guess this is due to the calculations (width height of a page). But this is pretty strange behaviour I think so it would be nice if there was an extra setting that forces all pages to be displayed horizontal or vertical.

    So that the pages are readable in the same orientation the device is in..

    opened by lopezzbelgium 11
  • error

    error

    Caused by: java.lang.UnsatisfiedLinkError: Native method not found: main.java.org.vudroid.pdfdroid.codec.PdfDocument.open:(ILjava/lang/String;Ljava/lang/String;)J

    opened by balasaheb143 11
  • RuntimeException: error loading page

    RuntimeException: error loading page

    I can't open a downloaded PDF on a Galaxy S3 Mini. It always causes the following exception:

    java.lang.RuntimeException: error loading page at org.vudroid.pdfdroid.codec.PdfPage.open(Native Method) at org.vudroid.pdfdroid.codec.PdfPage.createPage(PdfPage.java:55) at org.vudroid.pdfdroid.codec.PdfDocument.getPage(PdfDocument.java:18) at org.vudroid.core.DecodeServiceBase.getPage(DecodeServiceBase.java:175) at org.vudroid.core.DecodeServiceBase.getPageWidth(DecodeServiceBase.java:214) at com.joanzapata.pdfview.PDFView.loadComplete(PDFView.java:647) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:58) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:31) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4867) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) at dalvik.system.NativeStart.main(Native Method)

    I can't reproduce this error on my HTC One M8, I don't know how to fix it, but it seems that there's an error in your library. Would be nice if you can fix it! :)

    bug 
    opened by carstenbaumhoegger 9
  • Update PdfPage.java

    Update PdfPage.java

    Hey,

    First of all, thanks a lot for that tremendous component you provided.

    I ran into a regular crash when i was using the component to display various pdf file : on the left pane the name of the file and when the user click on a name, the pdf is displayed on the right.

    Switching quickly between files to display led me into a RunTimeException in the function :

    static PdfPage createPage(long dochandle, int pageno) { return new PdfPage(open(dochandle, pageno), dochandle); }

    in org.vudroid.pdfdroid.codec.PdfPage

    A little investigation led me to find that this happened when two threads was calling this function at the same time.

    Just added a "synchronized" qualifier on the function and that bug was gone.

    opened by ouani 6
  • Slow rendering

    Slow rendering

    Hello! I'm trying to use an amazing android-pdfview library in my app. However pdf rendering is veeery slow. Viewer shows a blank white screen about 2-4 sec and then starts to render: screenshot_2014-10-03-18-29-17 (device: Nexus 7 first generation). Pdf has only 1 page but it remains unreadable during several seconds while viewer is slowly making the document readable by square zones. Yes, finally pdf is readable, but it takes more than 10-15 seconds - totally user-unfriendly. Is it common problem? How could I accelerate rendering?

    opened by IlyaBlokh 5
  • Add ability by call PDFView.recycle(), recycle for all instances of pdfview

    Add ability by call PDFView.recycle(), recycle for all instances of pdfview

    For example if I want to use pdfView in viewPager. I should tracked that that pdfView on previous page was recycled, before showing pdf on current page.

    opened by mr-procrastinator 5
  • Get an error when adding it as a maven dep in Android studio

    Get an error when adding it as a maven dep in Android studio

    A problem occurred configuring project ':app'.

    Could not download artifact 'com.joanzapata.pdfview:android-pdfview:1.0.0:android-pdfview.jar'
    Artifact 'com.joanzapata.pdfview:android-pdfview:1.0.0:android-pdfview.jar' not found.
    
    opened by EsSpectacularrr 5
  • pdf file is not visible in the sample.

    pdf file is not visible in the sample.

    Hi ,

    I have donwloaded and have configured the sample also with actionbarsherlock and annotations. But after opening app it simpley shows while page. its not showing the menu options also . please suggest.

    Thanks, Rajesh device-2013-05-31-181223

    Please response as soon as possible.

    opened by ItsRajesh4uguys 5
  • What is minimap?

    What is minimap?

    Hello, I wanted to ask what is minimap showing? Because I don't see any difference when the flag is either true of false. I need to make a view, where the thumbnails of all pages in pdf will be shown, and you can jump to any of them on click. I thought minimap will show me all that pages, but for now I don't understand what is it doing at all.

    opened by zavernutiy 4
  • RuntimeException: error loading page

    RuntimeException: error loading page

    PDF file just one page. error show:

    java.lang.RuntimeException: error loading page at org.vudroid.pdfdroid.codec.PdfPage.open(Native Method) at org.vudroid.pdfdroid.codec.PdfPage.createPage(PdfPage.java:55) at org.vudroid.pdfdroid.codec.PdfDocument.getPage(PdfDocument.java:18) at org.vudroid.core.DecodeServiceBase.getPage(DecodeServiceBase.java:175) at org.vudroid.core.DecodeServiceBase.getPageWidth(DecodeServiceBase.java:214) at com.joanzapata.pdfview.PDFView.loadComplete(PDFView.java:644) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:58) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:31) at android.os.AsyncTask.finish(AsyncTask.java:667) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6121) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

    opened by zhaowei0109 1
  • crash

    crash

    java.lang.RuntimeException: error loading page at org.vudroid.pdfdroid.codec.PdfPage.open(Native Method) at org.vudroid.pdfdroid.codec.PdfPage.createPage(PdfPage.java:55) at org.vudroid.pdfdroid.codec.PdfDocument.getPage(PdfDocument.java:18) at org.vudroid.core.DecodeServiceBase.getPage(DecodeServiceBase.java:175) at org.vudroid.core.DecodeServiceBase.getPageWidth(DecodeServiceBase.java:214) at com.joanzapata.pdfview.PDFView.loadComplete(PDFView.java:644) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:58) at com.joanzapata.pdfview.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:31) at android.os.AsyncTask.finish(AsyncTask.java:636) at android.os.AsyncTask.access$500(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:210) at android.app.ActivityThread.main(ActivityThread.java:5809) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

    opened by zhangqilu 3
  • 无法解析PDF文件

    无法解析PDF文件

    java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.RuntimeException: error loading page at org.vudroid.pdfdroid.codec.PdfPage.open(Native Method) at org.vudroid.pdfdroid.codec.PdfPage.createPage(PdfPage.java:55) at org.vudroid.pdfdroid.codec.PdfDocument.getPage(PdfDocument.java:18) at org.vudroid.core.DecodeServiceBase.getPage(DecodeServiceBase.java:175) at com.joanzapata.pdfview.RenderingAsyncTask.proceed(RenderingAsyncTask.java:100) at com.joanzapata.pdfview.RenderingAsyncTask.doInBackground(RenderingAsyncTask.java:63) at com.joanzapata.pdfview.RenderingAsyncTask.doInBackground(RenderingAsyncTask.java:33) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:841)  该文件可以直接在浏览器查看,第一页展示也没有问题,但是第二页解析不出来,请问是PDF格式的问题吗?难道说PDF文件内部压缩还有其它问题? PDF文件下载地址:https://legacy.gitbook.com/download/pdf/book/hltj/kotlin-reference-chinese

    opened by Vicent9920 0
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022
(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.

BottomBar (Deprecated) I don't have time to maintain this anymore. I basically wrote the whole library in a rush, without tests, while being a serious

Iiro Krankka 8.4k Dec 29, 2022
Library and example project on how to use the UITableView component

UITableView for Android Usage Installation Android Studio Paste or clone this library into the /libs folder, in the root directory of your project. Cr

Thiago Locatelli 679 Nov 11, 2022
A tinder like swipeable card stack component

AndroidSwipeableCardStack Change log: provide option to infinitly swipe in a loop card rotation setting card gravity setting undo animation Thanks for

wenchao jiang 824 Nov 10, 2022
Component Box - a multiplatform server-driven UI framework

Component Box · Component Box is a multiplatform server-driven UI framework. Learn how to use Component Box in your project. Installation implementati

Dropbox 216 Dec 31, 2022
GreenDroid is a development library for the Android platform. It makes UI developments easier and consistent through your applications.

#GreenDroid Foreword : This project, initially initiated by me, Cyril Mottier, is not maintained anymore and can be considered as deprecated. As a con

Cyril Mottier 2.6k Jan 4, 2023
Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development

Mobile Kotlin widgets This is a Kotlin MultiPlatform library that provides declarative UI and application screens management in common code. You can i

IceRock Development 320 Dec 30, 2022
Sentinel is a simple one screen UI which provides a standardised entry point for tools used in development and QA alongside device, application and permissions data.

Sentinel Sentinel is a simple one screen UI that provides standardised entry point for tools used in development and QA alongside device, application

Infinum 29 Dec 12, 2022
Beagle is an open-source framework for cross-platform development using the concept of Server-Driven UI.

Beagle Getting Started · Learn the Basics · Contribute Beagle is an open-source framework for cross-platform development using the concept of Server-D

ZUP IT INNOVATION 657 Dec 28, 2022
A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications

Tweaks A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications To include the library add

Guillermo Merino Jiménez 4 Jan 14, 2022
MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team

MIUI 原生通知图标 Fix the native notification bar icon function abandoned by the MIUI

Fankesyooni 189 Jan 4, 2023
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022