Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open PDF in android using pdfview

Tags:

java

android

I am using android-pdfview-1.0.2.jar I found it here Link to the main project is here I am trying to load PDF as follows

PDFView pdfView= (PDFView) findViewById(R.id.pdfView);
pdfView.fromAsset("sample.pdf")
.defaultPage(1)
.showMinimap(false)
.enableSwipe(true)
.onLoad(this)
.onPageChange(this)
.load();

I have added pdfView in my layout as shown below

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

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

</FrameLayout>

while executing I am getting following error:

06-12 17:10:10.015: E/AndroidRuntime(21726): FATAL EXCEPTION: AsyncTask #1
06-12 17:10:10.015: E/AndroidRuntime(21726): java.lang.RuntimeException: An error occured while executing doInBackground()
06-12 17:10:10.015: E/AndroidRuntime(21726):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.FutureTask.run(FutureTask.java:239)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.lang.Thread.run(Thread.java:838)
06-12 17:10:10.015: E/AndroidRuntime(21726): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load vudroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.klouddata.pdffileexample-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.klouddata.pdffileexample-2, /vendor/lib, /system/lib]]]: findLibrary returned null
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.lang.Runtime.loadLibrary(Runtime.java:359)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.lang.System.loadLibrary(System.java:514)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at org.vudroid.core.VuDroidLibraryLoader.load(VuDroidLibraryLoader.java:13)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at org.vudroid.pdfdroid.codec.PdfContext.<clinit>(PdfContext.java:13)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:50)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-12 17:10:10.015: E/AndroidRuntime(21726):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-12 17:10:10.015: E/AndroidRuntime(21726):    ... 3 more
like image 723
DCoder Avatar asked Jun 12 '14 11:06

DCoder


1 Answers

Solved problem by adding armeabi-v7a folder which can be found here

now sample.pdf looks like enter image description here

like image 123
DCoder Avatar answered Oct 04 '22 01:10

DCoder