jblough / android-pdf-viewer-library Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED - Pdf Viewer library for Android
DEPRECATED - Pdf Viewer library for Android
This is a packaging of the project "Android PDF Viewer" (http://andpdf.sourceforge.net/) into a reusable library to make PDF viewing easier from within your Android application. Consistent with the Android PDF Viewer project, the licensing for the PdfViewer project is LGPL Quickstart incorporating a PDF viewing activity into your project: 1) Add PdfViewer.jar into your project's build path 2) Copy the following drawable resources from PdfViewer/res/drawable into YourProject/res/drawable left_arrow.png right_arrow.png zoom_in.png zoom_out.png 3) Copy the following layout resources from PdfViewer/res/layout into YourProject/res/layout dialog_pagenumber.xml pdf_file_password.xml 4) Derive your PDF activity from net.sf.andpdf.pdfviewer.PdfViewerActivity 5) Using the default drawables and layouts: public int getPreviousPageImageResource() { return R.drawable.left_arrow; } public int getNextPageImageResource() { return R.drawable.right_arrow; } public int getZoomInImageResource() { return R.drawable.zoom_in; } public int getZoomOutImageResource() { return R.drawable.zoom_out; } public int getPdfPasswordLayoutResource() { return R.layout.pdf_file_password; } public int getPdfPageNumberResource() { return R.layout.dialog_pagenumber; } public int getPdfPasswordEditField() { return R.id.etPassword; } public int getPdfPasswordOkButton() { return R.id.btOK; } public int getPdfPasswordExitButton() { return R.id.btExit; } public int getPdfPageNumberEditField() { return R.id.pagenum_edit; } 6) Invoke your PdfViewActivity derived with the following code: Intent intent = new Intent(this, YourPdfViewerActivity.class); intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, "PATH TO PDF GOES HERE"); startActivity(intent);
how to view pdf from server ?
Thanks In Advance.
This is Great Library I like it most
But have some issue like it taking time to change the page.
some time memory leak error is coming up and app force close with same pdf file but some time it is working with same pdf file..
But Overall great library.
I want to implement
Hi, i was trying to use your library to show a pdf in my app ant it gives me that error...
E/APV.PDFRenderer﹕ null
java.lang.NullPointerException
at android.graphics.Canvas.drawBitmap(Canvas.java:1195)
at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:390)
at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:685)
at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
at segesa.catalogo.VisorPDF$2.doInBackground(VisorPDF.java:117)
at segesa.catalogo.VisorPDF$2.doInBackground(VisorPDF.java:73)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
Its gives me the correct number of pages, but it dosent show anything.
The pdf im trying to open is in that url
http://www.cealsa.com/folletoiphone/folletoiphone.pdf
But im trying to open it locally, from my internal storage.
Thanks
Download a pdf file from web, save it to /data/data/package/files/xxxx.pdf
when open the file
06-25 18:15:38.781: I/PDFVIEWER(10928): Intent { flg=0x10000000 cmp=aobo.judgment/.PdfViewActivity (has extras) }
06-25 18:15:38.781: I/PDFVIEWER(10928): ST='file '/data/data/aobo.judgment/files/download.pdf' has 230400 bytes'
06-25 18:15:38.781: W/System.err(10928): java.lang.NullPointerException
06-25 18:15:38.781: W/System.err(10928): at com.sun.pdfview.PDFFile.readTrailer15(PDFFile.java:1196)
06-25 18:15:38.781: W/System.err(10928): at com.sun.pdfview.PDFFile.readTrailer(PDFFile.java:1028)
06-25 18:15:38.791: W/System.err(10928): at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1420)
06-25 18:15:38.791: W/System.err(10928): at com.sun.pdfview.PDFFile.(PDFFile.java:140)
06-25 18:15:38.791: W/System.err(10928): at com.sun.pdfview.PDFFile.(PDFFile.java:116)
06-25 18:15:38.791: W/System.err(10928): at net.sf.andpdf.pdfviewer.PdfViewerActivity.openFile(PdfViewerActivity.java:851)
06-25 18:15:38.791: W/System.err(10928): at net.sf.andpdf.pdfviewer.PdfViewerActivity.parsePDF(PdfViewerActivity.java:815)
06-25 18:15:38.791: W/System.err(10928): at net.sf.andpdf.pdfviewer.PdfViewerActivity.setContent(PdfViewerActivity.java:221)
06-25 18:15:38.791: W/System.err(10928): at net.sf.andpdf.pdfviewer.PdfViewerActivity.onCreate(PdfViewerActivity.java:212)
06-25 18:15:38.791: W/System.err(10928): at aobo.judgment.PdfViewActivity.onCreate(PdfViewActivity.java:9)
06-25 18:15:38.791: W/System.err(10928): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-25 18:15:38.791: W/System.err(10928): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-25 18:15:38.791: W/System.err(10928): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-25 18:15:38.791: W/System.err(10928): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-25 18:15:38.791: W/System.err(10928): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-25 18:15:38.791: W/System.err(10928): at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 18:15:38.791: W/System.err(10928): at android.os.Looper.loop(Looper.java:123)
06-25 18:15:38.791: W/System.err(10928): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-25 18:15:38.791: W/System.err(10928): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 18:15:38.791: W/System.err(10928): at java.lang.reflect.Method.invoke(Method.java:521)
06-25 18:15:38.791: W/System.err(10928): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-25 18:15:38.791: W/System.err(10928): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-25 18:15:38.791: W/System.err(10928): at dalvik.system.NativeStart.main(Native Method)
06-25 18:15:38.791: I/PDFVIEWER(10928): ST='Exception: null'
06-25 18:15:38.801: I/PDFVIEWER(10928): ST='reading page 1, zoom:1.0'
How i can decrease image size without changing image's width and height. (I use curl page project on github). and also sun's pdf reader reads pdf so slow it affects page curl. So i use thread's to handling this problem. But there is a problem here, i must have 10 image to apply this algorithm. But Java's vm
breaks project (out of memory error). I found only way change width and height, but page's can not readable (so small). Any idea for that problems?. Thanks for everything, and also sorry for bad English.
I am getting this error while loading big pdfs:
AWTPDF.pdfimage(1258): image too large (OutOfMemoryError)
I need to access a surface view which i have defined and added through the library to the pdf viewer but it does not recognise the variable in the project even after i have imported the library there.
Can this be a view instead of an activity? It would be nice to embed the pdf in fragment of an already existing activity.
When I open pdf, this exception is come out and keep showing loading icon. May I know what is wrong?
06-26 15:20:21.485: E/PDFVIEWER(24225): java.nio.BufferUnderflowException
06-26 15:20:21.485: E/PDFVIEWER(24225): at java.nio.Buffer.checkGetBounds(Buffer.java:177)
06-26 15:20:21.485: E/PDFVIEWER(24225): at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:41)
06-26 15:20:21.485: E/PDFVIEWER(24225): at java.nio.MappedByteBufferAdapter.get(MappedByteBufferAdapter.java:144)
06-26 15:20:21.485: E/PDFVIEWER(24225): at java.nio.ByteBuffer.get(ByteBuffer.java:384)
06-26 15:20:21.485: E/PDFVIEWER(24225): at net.sf.andpdf.nio.NioByteBuffer.get(NioByteBuffer.java:99)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.decode.FlateDecode.decode(FlateDecode.java:68)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:92)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:334)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:266)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:260)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.PDFFile.getContents(PDFFile.java:1642)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.sun.pdfview.PDFFile.getPage(PDFFile.java:1577)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.osim.corporatesales.PdfViewerActivity.showPage(PdfViewerActivity.java:780)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.osim.corporatesales.PdfViewerActivity.access$12(PdfViewerActivity.java:770)
06-26 15:20:21.485: E/PDFVIEWER(24225): at com.osim.corporatesales.PdfViewerActivity$3.run(PdfViewerActivity.java:260)
06-26 15:20:21.485: E/PDFVIEWER(24225): at java.lang.Thread.run(Thread.java:856)
Hi !
I'm really interested in this project,
did you have good result so far ?
I cannot render pdf pages, it gives me a lot of
com.sun.pdfview.PDFParseException: Expected a number here.
java.nio.BufferUnderflowException
java.lang.NullPointerException
this is not crashing down the app but the page is never fully rendered : there is missing text or missing picture on each page and at random position...
can I send you a pdf file so you could try on it and maybe fix this problem ?
Hei, I want to ask, why this pdf viewer can't display images in the pdf? It's like displaying some bars and images aren't shown properly.
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.
I have a problem with the loading of the page of pdfs. It work perfectly on the Galaxy note 2, but in my galaxy s4 mini it stop on the loading pdf dialog. Without any errors or Logs.
How is it possible?
Thanks
I have a pdf of a scanned book (bad me. : ( Couldn't find it legit). When I run it through the code on my AVD, I get the white screen, page 1 /142, and nothing else except this in logcat:
07-15 21:59:53.345 8223-8223/com.sample.pdfwebviewer I/Web Console﹕ Warning: Setting up fake worker. at file:///android_asset/pdfviewer/pdf.js:235
07-15 22:00:16.934 8223-8223/com.sample.pdfwebviewer I/Web Console﹕ Warning: Unhandled rejection: TypeError: Illegal constructor
TypeError: Illegal constructor
at Object.createBlob (file:///android_asset/pdfviewer/pdf.worker.js:1439:12)
at Object.createObjectURL (file:///android_asset/pdfviewer/pdf.worker.js:1455:24)
at Object.JpegStream_getIR as getIR
at Object.PartialEvaluator_buildPaintImageXObject as buildPaintImageXObject
at Object.next (file:///android_asset/pdfviewer/pdf.worker.js:11210:24)
at Object.Promise (file:///android_asset/pdfviewer/pdf.js:1237:16)
at Object.PartialEvaluator_getOperatorList as getOperatorList
at Object.onResolve (file:///android_asset/pdfviewer/pdf.worker.js:2752:33)
at Object.runHandlers (file:///android_asset/pdfviewer/pdf.js:1159:35) at file:///android_asset/pdfviewer/pdf.js:235
I thought maybe my AVD didn't have enough memory (going to check that RSN), but I wondered if the run handlers to which the logcat refers are the real problem--what they heck are they?
sudo apt-get install vsftpd -y
Hello, is it possible to view pdf that stored in server? So we see it online using the application instead of download the file and then view it using the application. I really need the answer for my thesis. Thank you so much for your help.
Hi, I am using your library to render pdf files , I see BufferUnderFlowException in logcat in some of the sony Xperia devices, moreover when I manually jump to a random page , the contents sometimes are not rendered properly , any particular cause ?
Here's the logcat snapshot
05-05 16:31:53.765: D/OpenGLRenderer(15005): Enabling debug mode 0
05-05 16:31:56.908: I/PDFVIEWER(15005): onCreate
05-05 16:31:56.908: E/PDFVIEWER(15005): restoreInstance
05-05 16:31:56.978: I/PDFVIEWER(15005): Intent { cmp=com.granthi.mgranthi/com.tusharsappal.granthi.mgranthi.Second (has extras) }
05-05 16:31:56.988: I/PDFVIEWER(15005): ST='file '/storage/sdcard0/Android/data/com.granthi.mgranthi/files/Sukhmani-Sahib-Gurumukhi.pdf' has 133524 bytes'
05-05 16:31:57.028: I/PDFVIEWER(15005): ST='Anzahl Seiten:78'
05-05 16:31:57.048: I/PDFVIEWER(15005): ST='reading page 1, zoom:1.0'
05-05 16:32:00.562: I/PDFVIEWER(15005): ST='reading page 1, zoom:1.5'
05-05 16:32:01.824: I/PDFVIEWER(15005): ST='reading page 1, zoom:1.0'
05-05 16:32:02.594: I/PDFVIEWER(15005): ST='reading page 1, zoom:0.6666667'
05-05 16:32:03.385: I/PDFVIEWER(15005): ST='reading page 1, zoom:1.0'
05-05 16:32:04.146: I/PDFVIEWER(15005): ST='reading page 2, zoom:1.0'
05-05 16:32:04.206: D/dalvikvm(15005): GC_CONCURRENT freed 5494K, 45% free 7057K/12816K, paused 3ms+30ms, total 97ms
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): cmd='Tf:null
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): java.nio.BufferUnderflowException
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at java.nio.Buffer.checkGetBounds(Buffer.java:177)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:41)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at java.nio.MappedByteBufferAdapter.get(MappedByteBufferAdapter.java:144)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at java.nio.ByteBuffer.get(ByteBuffer.java:384)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.nio.NioByteBuffer.get(NioByteBuffer.java:99)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.decode.FlateDecode.decode(FlateDecode.java:68)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:92)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:334)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.getStreamBuffer(PDFObject.java:307)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.getStreamBuffer(PDFObject.java:304)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.font.TTFFont.(TTFFont.java:80)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.font.PDFFont.getFont(PDFFont.java:165)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.getFontFrom(PDFParser.java:1349)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.iterate(PDFParser.java:848)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFFile.getPage(PDFFile.java:1589)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:779)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
05-05 16:32:04.236: E/ANDPDF.pdfparser(15005): at java.lang.Thread.run(Thread.java:856)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): cmd='Tj:null
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): java.lang.NullPointerException
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFTextFormat.doTextNormal(PDFTextFormat.java:324)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFTextFormat.doText(PDFTextFormat.java:271)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.iterate(PDFParser.java:884)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFFile.getPage(PDFFile.java:1589)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:779)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
05-05 16:32:04.266: E/ANDPDF.pdfparser(15005): at java.lang.Thread.run(Thread.java:856)
05-05 16:32:09.071: I/PDFVIEWER(15005): ST='reading page 2, zoom:1.5'
05-05 16:32:09.121: D/dalvikvm(15005): GC_FOR_ALLOC freed 1820K, 47% free 6879K/12816K, paused 34ms, total 46ms
05-05 16:32:09.121: I/dalvikvm-heap(15005): Grow heap (frag case) to 10.994MB for 2181184-byte allocation
05-05 16:32:09.211: D/dalvikvm(15005): GC_CONCURRENT freed 101K, 31% free 8926K/12816K, paused 6ms+14ms, total 84ms
05-05 16:32:23.617: I/PDFVIEWER(15005): ST='reading page 10, zoom:1.5'
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): cmd='Tf:null
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): java.nio.BufferUnderflowException
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.nio.Buffer.checkGetBounds(Buffer.java:177)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:41)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.nio.MappedByteBufferAdapter.get(MappedByteBufferAdapter.java:144)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.nio.ByteBuffer.get(ByteBuffer.java:384)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.nio.NioByteBuffer.get(NioByteBuffer.java:99)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.decode.FlateDecode.decode(FlateDecode.java:68)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:92)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:334)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.getStreamBuffer(PDFObject.java:307)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFObject.getStreamBuffer(PDFObject.java:304)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.font.TTFFont.(TTFFont.java:80)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.font.PDFFont.getFont(PDFFont.java:165)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.getFontFrom(PDFParser.java:1349)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.iterate(PDFParser.java:848)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFFile.getPage(PDFFile.java:1589)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:779)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.lang.Thread.run(Thread.java:856)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): cmd='Tj:null
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): java.lang.NullPointerException
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFTextFormat.doTextNormal(PDFTextFormat.java:324)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFTextFormat.doText(PDFTextFormat.java:271)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFParser.iterate(PDFParser.java:884)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at com.sun.pdfview.PDFFile.getPage(PDFFile.java:1589)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:779)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
05-05 16:32:23.697: E/ANDPDF.pdfparser(15005): at java.lang.Thread.run(Thread.java:856)
05-05 16:32:23.867: D/dalvikvm(15005): GC_FOR_ALLOC freed 1734K, 36% free 8276K/12816K, paused 28ms, total 28ms
05-05 16:32:23.877: I/dalvikvm-heap(15005): Grow heap (frag case) to 12.359MB for 2181184-byte allocation
05-05 16:32:23.917: D/dalvikvm(15005): GC_CONCURRENT freed 75K, 31% free 10340K/14948K, paused 3ms+6ms, total 41ms
05-05 16:32:24.047: W/IInputConnectionWrapper(15005): finishComposingText on inactive InputConnection
05-05 16:32:24.047: W/IInputConnectionWrapper(15005): finishComposingText on inactive InputConnection
05-05 16:32:27.711: I/PDFVIEWER(15005): ST='reading page 10, zoom:1.0'
05-05 16:32:33.718: I/PDFVIEWER(15005): ST='reading page 9, zoom:1.0'
05-05 16:32:33.998: D/dalvikvm(15005): GC_CONCURRENT freed 5084K, 44% free 7218K/12820K, paused 4ms+11ms, total 43ms
05-05 16:32:33.998: D/dalvikvm(15005): WAIT_FOR_CONCURRENT_GC blocked 9ms
Hi, I try your library to read a pdf and I think I followed all your instructions:
Uri path =Uri.parse("file:///android_asset/test");
Intent intent = new Intent(this, PdfReaderActivity.class);
intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path.toString());
startActivity(intent);
but I always have a logcat message with :
ST='file 'file:///android_asset/test' not found'
I tried adding .pdf at the end but it doesn't change. Can you help me please?
text with black font color is missed at attached pdf file
Which is the default activity file?
Hello,
I want to use your code in a commercial product. do we need to purchase a license.
If it is a public license, what kind of license is this library published?
Greetings and Thanks in advance.
The image rendering capability of library works fine with Gingerbread OS and lower but not in ICS and up.
Can anybody tell me that how to set image to graphview so that first page of PDF file accurately set inside graph means no need to scroll or zoom...
thanks
Hello,
I am getting a url of the location where the PDF is stored. I want to open the pdf with the pdfviewer. Can I get the guideline to open it as currently I am saving the url in string and then I am passing the string as the path of the pdf to the Activity through the intent
final Intent readPdf = new Intent(getApplicationContext(), PdfViewerActivity.class);
readPdf.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
readPdf.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
startActivity(readPdf);
It shows me PDF does not exists but the pdf is available.
please guide.
PDFParseException : could not decode image of compressed size 36042.
There is lot of images in pdf.So the log cat shows this exception. Please help us to overcome this problem.
Hi,
How can I use this library with Fragment. I have gone through the source code, current code only supports only Activity. Please help me to achieve the same with Fragment.
Thanks
Hi, my compliments for the great work. I have any problem, when I open some document (in simulator or phone), the pdf was opened in 20 sec approximately, same when I touch zoom button.. Exists a method for fix that? Thanks
Ps: sorry for my bad english
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Expected: PDF rendered with images
Result: PDF rendered without images and 3 exceptions thrown
What version of the product are you using? On what operating system?
Android Emulator API 2.2 running on Mac OSX 10.7.5
Please provide any additional information below.
I/ActivityManager( 72): Displayed activity com.xx/.BillViewerActivity: 1078 ms (total 1078 ms)
D/dalvikvm( 377): GC_FOR_MALLOC freed 28334 objects / 1223752 bytes in 154ms
D/dalvikvm( 377): GC_EXTERNAL_ALLOC freed 30332 objects / 1142920 bytes in 102ms
E/dalvikvm-heap( 377): 17413712-byte external allocation too large for this process.
E/GraphicsJNI( 377): VM won't let us allocate 17413712 bytes
D/skia ( 377): --- decoder->decode returned false
E/AWTPDF.pdfimage( 377): image too large (OutOfMemoryError)
I/AWTPDF.pdfimage( 377): Creating Image width=96, Height=96, bpc=1,cs=ColorSpace[RGB]
E/APV.PDFRenderer( 377): null
E/APV.PDFRenderer( 377): java.lang.ArrayIndexOutOfBoundsException
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.parseData(PDFImage.java:277)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.getImage(PDFImage.java:225)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:790)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
E/APV.PDFRenderer( 377): at java.lang.Thread.run(Thread.java:1096)
E/ANDPDF.dctdecode( 377): decoded image typeRGB_565
I/AWTPDF.pdfimage( 377): Creating Image width=154, Height=153, bpc=8,cs=ColorSpace[RGB]
I/AWTPDF.pdfimage( 377): millis for converting image=2
I/AWTPDF.pdfimage( 377): Creating Image width=70, Height=70, bpc=1,cs=ColorSpace[RGB]
E/APV.PDFRenderer( 377): null
E/APV.PDFRenderer( 377): java.lang.ArrayIndexOutOfBoundsException
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.parseData(PDFImage.java:277)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.getImage(PDFImage.java:225)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:790)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
E/APV.PDFRenderer( 377): at java.lang.Thread.run(Thread.java:1096)
I/AWTPDF.pdfimage( 377): Creating Image width=74, Height=74, bpc=1,cs=ColorSpace[RGB]
E/APV.PDFRenderer( 377): null
E/APV.PDFRenderer( 377): java.lang.ArrayIndexOutOfBoundsException
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.parseData(PDFImage.java:277)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImage.getImage(PDFImage.java:225)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
E/APV.PDFRenderer( 377): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
E/APV.PDFRenderer( 377): at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:790)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
E/APV.PDFRenderer( 377): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
E/APV.PDFRenderer( 377): at java.lang.Thread.run(Thread.java:1096)
E/ThrottleService( 72): Error reading data file
Hi:
It is a very good library for pdf render thanks a lot I used it on android 2.3 and it works fine, but when I try to use the jar on Android 3 and 4 it doesn't work, I got this error
W/System.err(766): java.lang.NoClassDefFoundError: org.bouncycastle.crypto.engines.RC4Engine
could u plz help me....?
Thanks in advanced
Hi,
I make a Demo with this library and when the pdf is loaded the document view with bars and black and white. Somebody have a solution?
Hello Joe,
I have implemented this library, and It was working as expected Thanks!!, however it does not work well with the latest Android 7 OS (Nougat); the PDF file keeps loading, I have tried a direct path (file:///android_asset/) to the PDFs files, but it did not work. please advise.
Thank you
Appreciate your work done, it helped me in great amount. I like to know that if it is possible that I can show the PDF in my own layout. As I have one layout in which I have one header and footer, I want to display PDF in between them both. So it it possible?
Thanks
During page renreding I catched this error. Also page was rendered incorect.
Stack trace
12-18 13:01:53.501: E/APV.PDFRenderer(5425): null
12-18 13:01:53.501: E/APV.PDFRenderer(5425): java.nio.BufferUnderflowException
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at java.nio.Buffer.checkGetBounds(Buffer.java:177)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:41)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at java.nio.MappedByteBufferAdapter.get(MappedByteBufferAdapter.java:144)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at java.nio.ByteBuffer.get(ByteBuffer.java:384)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at net.sf.andpdf.nio.NioByteBuffer.get(NioByteBuffer.java:99)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.decode.DCTDecode.decode(DCTDecode.java:73)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:102)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:334)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:266)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:260)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFImage.getImage(PDFImage.java:224)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:794)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:773)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
12-18 13:01:53.501: E/APV.PDFRenderer(5425): at java.lang.Thread.run(Thread.java:856)
It doesn't open files from Assets. When the PDF activity open it shows a Loading dialog and do nothing!
i have used this library but this gave following error
java.lang.ArrayIndexOutOfBoundsException: length=16; index=34
at com.sun.pdfview.colorspace.IndexedColor.toColor(IndexedColor.java:122)
at com.sun.pdfview.PDFImage.parseData(PDFImage.java:312)
at com.sun.pdfview.PDFImage.getImage(PDFImage.java:225)
at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:790)
at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
at java.lang.Thread.run(Thread.java:841)
Hi,
The works look good. and its ray of hope for me. I tried to integrate your stuff in my project. But I got Activity Instantiation Error.
Steps I followed :
Add jar files to my build path.
Copy Drawables and layout.
Copy your pdfviewer activity.
Add lines in manifest.
Pass Intent.
I dont know where I am doing mistake.
Can you please guide me. I am stuck up at one of my project.
If i use the getPage method i get the incorrect page.
For example if there is a 10 page pdf file.
getPage(0, true) - returns page 1
getPage(1, true) - returns page 1
getPage(2, true) - returns page 2
getPage(3, true) - returns page 3
...
getPage(9, true) - returns page 9
getPage(10, true) - java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
How do i get page 10?
I have done exactly as instructed in the readme. Despite this, the "loading pdf page" dialog never goes away. If this is because the file can't be found, there should be a timeout. But, it's not because the filepath is bad. I know because tapping out of the dialog will occasionally result in a partial page display. Even stranger, sometimes I can hit an arrow and the page will load correctly.
Simply put, this library seems to be unusable or I'm really missing something.
Please help. Thanks
I am using the pdfviewer.jar given by you to display a pdf documnet, It was working fine thanks to you for the jar file.
But the issue is the data's are displaying correctly but the images are displaying as error code in the document in the view mode. Please check the issue and upload a new jar.
Thanks in advance.
Regards,
Dinesh.
I have updated a method to get bitmap of pdf page which i want to use. but i am unable to get new jar .Please somebody could help me with this issue.
how I am using it..txt
i add a pdf file with pdfpassword in that class it gives Stackoverflow issues to me.
at line 56
@Override
public void init(int mode, SecretKeySpec keySpec, IvParameterSpec Iv) {
init(mode, keySpec, Iv); //why recursion?
}
Hi,
I am using your library to show pdf in my app. I am getting this error, kindly help me to solve this problem:
11-02 03:14:15.247: W/System.err(628): com.sun.pdfview.PDFParseException: Unknown coding method:JPXDecode
11-02 03:14:15.247: W/System.err(628): at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:115)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:334)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:266)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFObject.getStream(PDFObject.java:260)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFImage.getImage(PDFImage.java:224)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
11-02 03:14:15.257: W/System.err(628): at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
11-02 03:14:15.266: W/System.err(628): at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
11-02 03:14:15.266: W/System.err(628): at com.sun.pdfview.BaseWatchable.execute(BaseWatchable.java:263)
11-02 03:14:15.266: W/System.err(628): at com.sun.pdfview.BaseWatchable.go(BaseWatchable.java:197)
11-02 03:14:15.266: W/System.err(628): at com.sun.pdfview.PDFPage.getImage(PDFPage.java:237)
11-02 03:14:15.266: W/System.err(628): at net.sf.andpdf.pdfviewer.PdfViewerActivity.showPage(PdfViewerActivity.java:792)
11-02 03:14:15.266: W/System.err(628): at net.sf.andpdf.pdfviewer.PdfViewerActivity.access$12(PdfViewerActivity.java:769)
11-02 03:14:15.266: W/System.err(628): at net.sf.andpdf.pdfviewer.PdfViewerActivity$3.run(PdfViewerActivity.java:259)
11-02 03:14:15.266: W/System.err(628): at java.lang.Thread.run(Thread.java:1096)
Thanks in advance.
Yousuf
We're using Pdf-Viewer-Library to render documents to images. It's working ok, for our use the defect is that it seems it renders the page on a black background: when we have pdf pages with black text on transparent, everything is black.
Is it our mistake or something we can tweak in the library ?
Thanks
I'm using the PDFViewer library and I have the next System.err:
12-28 17:27:03.866 32545-32545/com.... W/System.err: com.sun.pdfview.decrypt.PDFAuthenticationFailureException: Password failed authentication for both owner and user password
12-28 17:27:03.874 32545-32545/com.... W/System.err: at com.sun.pdfview.decrypt.StandardDecrypter.<init>(StandardDecrypter.java:200)
12-28 17:27:03.874 32545-32545/com.... W/System.err: at com.sun.pdfview.decrypt.PDFDecrypterFactory.createStandardDecrypter(PDFDecrypterFactory.java:316)
12-28 17:27:03.874 32545-32545/com.... W/System.err: at com.sun.pdfview.decrypt.PDFDecrypterFactory.createDecryptor(PDFDecrypterFactory.java:99)
12-28 17:27:03.874 32545-32545/com.... W/System.err: at com.sun.pdfview.PDFFile.readTrailer(PDFFile.java:1108)
12-28 17:27:03.874 32545-32545/com.... W/System.err: at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1420)
12-28 17:27:03.882 32545-32545/com.... W/System.err: at com.sun.pdfview.PDFFile.<init>(PDFFile.java:140)
12-28 17:27:03.882 32545-32545/com.... W/System.err: at com.....visor.xml.objects.Strip.renderToBitmap(Strip.java:332)
The code is:
@Nullable
private static Bitmap renderToBitmap(InputStream inputStream) {
Bitmap bitmap = null;
try {
byte[] decode = org.apache.commons.io.IOUtils.toByteArray(inputStream);
ByteBuffer byteBuffer = ByteBuffer.wrap(decode);
PDFPage mPdfPage = new PDFFile(byteBuffer, null).getPage(0);
float width = mPdfPage.getWidth();
float height = mPdfPage.getHeight();
RectF clip = null;
bitmap = mPdfPage.getImage((int) (width), (int) (height), clip, true, true);
} catch (IOException ex) {
ex.printStackTrace();
}
return bitmap;
}
and has been found here.
The exact line that the Androir Monitor says the problem is, is the next:
PDFPage mPdfPage = new PDFFile(byteBuffer, null).getPage(0);
Any suggestion? Thank you very much.
Did i forgot to read the wiki or
is it not fully implemented yet using the page number?
thanks in advanced!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.