0
Planned

java issues...crashing on scanning large PDF's

Anthony Reinking 8 years ago updated 8 years ago 3

Converting these is not acceptable as I have over 500, and all of what I download is PDF format.

What can I do to avoid this crash? I am using the latest JAVA on Windows 2012R2, this was working fine up until one of the latest updates of Ubooquity?


Here is the error message, as soon as I start an 'admin' scan of my magazines.


20161218 10:32:12 [Scanner thread] ERROR com.ubooquity.Ubooquity - Uncaught exception on thread: Scanner thread
java.lang.OutOfMemoryError: Java heap space
   at java.awt.image.DataBufferByte.(Unknown Source) ~[na:1.8.0_111]
   at java.awt.image.ComponentSampleModel.createDataBuffer(Unknown Source) ~[na:1.8.0_111]
   at sun.awt.image.ByteInterleavedRaster.(Unknown Source) ~[na:1.8.0_111]
   at sun.awt.image.ByteInterleavedRaster.createCompatibleWritableRaster(Unknown Source) ~[na:1.8.0_111]
   at sun.awt.image.ByteInterleavedRaster.createCompatibleWritableRaster(Unknown Source) ~[na:1.8.0_111]
   at org.apache.pdfbox.filter.DCTFilter.fromBGRtoRGB(DCTFilter.java:245) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:170) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:69) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:163) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:235) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:565) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:233) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:138) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:340) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:781) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:62) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:94) ~[pdfbox-2.0.0.jar.1080217776487141892.tmp:2.0.0]
   at com.ubooquity.fileformat.pdf.b.a(SourceFile:71) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.fileformat.pdf.b.a(SourceFile:44) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.data.feeder.a.b(SourceFile:382) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.data.feeder.a.a(SourceFile:212) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.data.feeder.a.b(SourceFile:316) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.data.feeder.a.a(SourceFile:35) ~[Ubooquity.jar:1.10.1]
   at com.ubooquity.data.feeder.a$1.run(SourceFile:116) ~[Ubooquity.jar:1.10.1]

   at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_111]

So, since the code 'broke' PDF cover scanning for some magazines, I reinstalled the JAR from 1.9.1 and it works fine.

If anyone has 1.10.0 or 1.10.1 and JAVA crashes the older versions from 1.9.1 and back work fine.

Planned

Ubooquity 1.9 and 1.10 do not use the same version of PdfBox (the lib used for PDF rendering), that's probably the cause of your problem.

Unfortunately, your covers are "broken" by the most recent version of PdfBox, which fixes a lot of problems for other PDF files. So I can't go back to the older version.


If you can provide me with a example of "broken" file, I'll take a look at what happens, in case there some fix I can apply (though its quite unlikely).


I'll continue to update PdfBox when I release versions of Ubooquity, so your problem might go away as PdfBox evolves (the project seems quite active).

I also plan to allow plugging external PDF renderers to Ubooquity (e.g. MuPdf, Poppler...) so that people can choose the one that suit their needs.

Thank you once again for this excellent app!

I have 'fixed' my issue by adding -Xmx1024m as a startup switch, thanks for pointing me to the F.A.Q.