jblough / Android-Pdf-Viewer-Library

DEPRECATED - Pdf Viewer library for Android
656 stars 329 forks source link

Getting NullPointer Exception while opening pdf file #17

Open shivakumars opened 11 years ago

shivakumars commented 11 years ago

Hi,

I m trying use this library to show PDF within my android application. And everything works well except, it is always showing loading in PDF Viewer activity.

Log: java.lang.NullPointerException at com.sun.pdfview.PDFFile.readTrailer15(PDFFile.java:1199) at com.sun.pdfview.PDFFile.readTrailer(PDFFile.java:1028) at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1420) at com.sun.pdfview.PDFFile.(PDFFile.java:140) at com.sun.pdfview.PDFFile.(PDFFile.java:116) at net.sf.andpdf.pdfviewer.PdfViewerActivity.openFile(PdfViewerActivity.java:851) at net.sf.andpdf.pdfviewer.PdfViewerActivity.parsePDF(PdfViewerActivity.java:815) at net.sf.andpdf.pdfviewer.PdfViewerActivity.setContent(PdfViewerActivity.java:221) at net.sf.andpdf.pdfviewer.PdfViewerActivity.onCreate(PdfViewerActivity.java:212) at android.app.Activity.performCreate(Activity.java:5206) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) at android.app.ActivityThread.access$700(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) 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:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method)

And i m also noticing this, 06-04 15:45:37.850: I/PDFVIEWER(13950): ST='file '/storage/sdcard0/Ticket.pdf' has 4198 bytes' 06-04 15:45:37.855: I/PDFVIEWER(13950): ST='Exception: null' 06-04 15:45:37.860: I/PDFVIEWER(13950): ST='reading page 1, zoom:1.0'

Please let me know, if you can help on this.

ndorigatti commented 11 years ago

did you gave permission to read/write on sdcard?

sid312 commented 11 years ago

I have given required permissions. But still pdf is not loading with same log.