mbaeuerle / Briss-2.0

Briss 2.0 is intended to be a GUI Update for the Briss PDF cropping tool.
GNU General Public License v3.0
486 stars 48 forks source link

feature_request(crop): more than 25 pages crop #16

Closed Kristinita closed 5 years ago

Kristinita commented 6 years ago

1. Summary

I can't crop my PDF books, if they have more than 25 pages.

2. Steps to reproduce

I run Briss → FileLoad file → I load this book.

3. Expected behavior

Ability to crop all pages.

4. Actual behavior

I can crop only initial 25 pages.

Briss__Crop_25_and_26_pages

After 25th page I get white squares that I can't crop.

Thanks.

cleydyr commented 6 years ago

Hi, @Kristinita !

I couldn't reproduce the behavior you're reporting on my Mac OSX (High Sierra 10.13.6) and using the Briss version that I downloaded from Sourceforge (0.9)

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

Here's a screenshot of what I've got screenshot

Can you give more detail on your environment so that we can check if it's an environment specific issue?

Thanks!

Kristinita commented 6 years ago

@cleydyr ,

D:\SashaDebugging\briss-0.9>java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)

Thanks.

cleydyr commented 6 years ago

Well, I'll have to get another virtual machine to test that. :) So it may take a little while to check.

Thanks!

mbaeuerle commented 6 years ago

I also could not reproduce this on Windows 10. This is the cropping view I get, and the result is cropped until the last page. grafik

cleydyr commented 6 years ago

Is there any logs from the application that you can provide, @Kristinita? Please execute the application using java -jar briss-0.9.jar on the command prompt and see if it produces any output when the error happens.

Kristinita commented 6 years ago

@cleydyr ,

D:\SashaDebugging\briss-0.9>java -jar briss-0.9.jar
java.lang.OutOfMemoryError: Java heap space
        at org.jpedal.jbig2.image.JBIG2Bitmap.clear(Unknown Source)
        at org.jpedal.jbig2.segment.pageinformation.PageInformationSegment.readSegment(Unknown Source)
        at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.readSegments(Unknown Source)
        at org.jpedal.jbig2.decoders.JBIG2StreamDecoder.decodeJBIG2(Unknown Source)
        at org.jpedal.jbig2.JBIG2Decoder.decodeJBIG2(Unknown Source)
        at org.jpedal.io.JBIG2.JBIGDecode(Unknown Source)
        at org.jpedal.io.PdfFilteredReader.decodeFilters(Unknown Source)
        at org.jpedal.io.PdfFileReader.readStream(Unknown Source)
        at org.jpedal.io.PdfReader.readStream(Unknown Source)
        at org.jpedal.parser.ImageDecoder.processXImage(Unknown Source)
        at org.jpedal.parser.ImageDecoder.processDOImage(Unknown Source)
        at org.jpedal.parser.PdfStreamDecoder.decodeStreamIntoObjects(Unknown Source)
        at org.jpedal.parser.PdfStreamDecoder.decodePageContent(Unknown Source)
        at org.jpedal.PDFtoImageConvertor.convert(Unknown Source)
        at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source)
        at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source)
        at at.laborg.briss.utils.ClusterRenderWorker.run(ClusterRenderWorker.java:45)
java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(Unknown Source)
        at java.awt.image.Raster.createPackedRaster(Unknown Source)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
        at java.awt.image.BufferedImage.<init>(Unknown Source)
        at org.jpedal.io.ColorSpaceConvertor.convertToRGB(Unknown Source)
        at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source)
        at org.jpedal.PdfDecoder.getPageAsImage(Unknown Source)
        at at.laborg.briss.utils.ClusterRenderWorker.run(ClusterRenderWorker.java:45)
Exception in thread "Thread-3" java.lang.NullPointerException
        at at.laborg.briss.model.ClusterImageData.initializeOutputImage(ClusterImageData.java:42)
        at at.laborg.briss.model.ClusterImageData.addImageToPreview(ClusterImageData.java:36)
        at at.laborg.briss.utils.ClusterRenderWorker.run(ClusterRenderWorker.java:46)

Thanks.

mbaeuerle commented 6 years ago

@Kristinita Seems like the Java VM runs out of heap space (memory). You can try to start the Java VM with java -Xmx2g -jar briss-0.9.jar (increasing the maximum heap size to 2 GB) and let us know if that works!

Kristinita commented 6 years ago

Status: :heavy_check_mark: Fixed for me

Fixed

Steps to reproduce

D:\SashaDebugging\briss-0.9>java -Xmx2g -jar briss-0.9.jar
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

I find an answer in Stack Overflow:

Could it be that you're using a 32-bit jvm on that machine?

Nothing dumb about that question! java -version will give you a hint. If it does not say 64-Bit, assume 32-bit.

D:\SashaDebugging\briss-0.9>java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)

my Java from Chocolatey.

It's strange that the 64-bit version was not automatically installed, as for all other programs.

D:\SashaDebugging\briss-0.9>choco install jre8 -PackageParameters "/exclude:32" -y --force
Chocolatey v0.10.3
Installing the following packages:
jre8
By installing you accept licenses for the packages.

jre8 v8.0.171 (forced) [Approved]
jre8 package files install completed. Performing other installation steps.
exclude Argument Found
Searching if new version exists...
Java Runtime Environment 8.0.1710.11 (32-bit) is already installed. Skipping download and installation
Downloading jre8 64 bit
  from 'https://javadl.oracle.com/webapps/download/AutoDL?BundleId=233172_512cd62ec5174c3487ac17c61aaa89e8'
Progress: 100% - Completed download of C:\Users\SashaChernykh\AppData\Local\Temp\chocolatey\jre8\8.0.171\jre8Install.exe (68.5 MB).
Download of jre8Install.exe (68.5 MB) completed.
Hashes match.
Installing jre8...
jre8 has been installed.
Searching if the previous version exists...
 The install of jre8 was successful.
  Software installed to 'C:\Program Files\Java\jre1.8.0_171\'

Chocolatey installed 1/1 packages. 0 packages failed.
 See the log for details (D:\Chocolatey\logs\chocolatey.log).

Now I can't reproduce the problem.

But I still have stack trace in console:

D:\SashaDebugging\briss-0.9>java -jar briss-0.9.jar
Exception in thread "Basic L&F File Loading Thread" java.lang.NullPointerException
        at at.laborg.briss.utils.PDFFileFilter.accept(PDFFileFilter.java:33)
        at javax.swing.JFileChooser.accept(Unknown Source)
        at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(Unknown Source)
        at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(Unknown Source)

Thanks.

cleydyr commented 6 years ago

Aha! Gotcha! That detail (if doesn't say it is 64 bit, then it's not) is new for me!

Regarding the NPE issue, can you kindly open another issue on the repo so as to not clutter the present issue? Also, please provide the steps to reproduce the NPE issue and the complete stacktrace.

Regards!

mbaeuerle commented 5 years ago

Closing, as the issue seems to be resolved. Feel free to respond if there are further issues.