During an attempt to convert pdf document to single page tiff files we get the following stacktrace:
class com.aspose.pdf.internal.ms.System.l5if:
java.lang.RuntimeException:
Error in processing graphic objects —>
java.lang.RuntimeException:
Error in processing graphic objects
— End of inner exception stack trace —
com.aspose.pdf.devices.lI.lI(Unknown Source)
com.aspose.pdf.devices.TiffDevice.processInternal(Unknown Source)
com.aspose.pdf.devices.DocumentDevice.processInternal(Unknown Source)
com.aspose.pdf.devices.DocumentDevice.process(Unknown Source)
com.stormed.common.utils.ImageUtils.pdfToTiffAspose(ImageUtils.java:204)
com.stormed.ocr.tesseract.PdfConvertTiff.getTiffs(PdfConvertTiff.java:25)
com.stormed.ocr.tesseract.Ocr.ocrextracted(Ocr.java:30)
com.stormed.ocr.OcrEpisodeII_Tesseract.ocr(OcrEpisodeII_Tesseract.java:22)
com.stormed.ocr.OcrMain.(OcrMain.java:94)
com.stormed.ocr.common.OcrBuilder.run(OcrBuilder.java:49)
com.stormed.proxy.AppRunner.run(AppRunner.java:21)
com.stormed.proxy.ProxyMain.runApp(ProxyMain.java:223)
com.stormed.proxy.ProxyMain.lambda$main$0(ProxyMain.java:115)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
at com.aspose.pdf.devices.lI.lI(Unknown Source)
at com.aspose.pdf.devices.TiffDevice.processInternal(Unknown Source)
at com.aspose.pdf.devices.DocumentDevice.processInternal(Unknown Source)
at com.aspose.pdf.devices.DocumentDevice.process(Unknown Source)
at com.stormed.common.utils.ImageUtils.pdfToTiffAspose(ImageUtils.java:204)
at com.stormed.ocr.tesseract.PdfConvertTiff.getTiffs(PdfConvertTiff.java:25)
at com.stormed.ocr.tesseract.Ocr.ocrextracted(Ocr.java:30)
at com.stormed.ocr.OcrEpisodeII_Tesseract.ocr(OcrEpisodeII_Tesseract.java:22)
at com.stormed.ocr.OcrMain.(OcrMain.java:94)
at com.stormed.ocr.common.OcrBuilder.run(OcrBuilder.java:49)
at com.stormed.proxy.AppRunner.run(AppRunner.java:21)
at com.stormed.proxy.ProxyMain.runApp(ProxyMain.java:223)
at com.stormed.proxy.ProxyMain.lambda$main$0(ProxyMain.java:115)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException:
Error in processing graphic objects at com.aspose.pdf.internal.l2h.l0h.lf(Unknown Source)
at com.aspose.pdf.internal.l2h.l0h.lt(Unknown Source)
at com.aspose.pdf.internal.l2h.lu.lf(Unknown Source)
at com.aspose.pdf.internal.l2h.lu.lI(Unknown Source)
… 17 more Caused by:
class com.aspose.pdf.exceptions.DrawStringException —>
java.lang.OutOfMemoryError: Java heap space
— End of inner exception stack trace —
com.aspose.pdf.internal.l10t.le.lI(Unknown Source)
com.aspose.pdf.internal.l10t.le.lI(Unknown Source)
com.aspose.pdf.internal.l3k.lI.lI(Unknown Source)
com.aspose.pdf.internal.l2h.l0h.lf(Unknown Source)
com.aspose.pdf.internal.l2h.l0h.lt(Unknown Source)
com.aspose.pdf.internal.l2h.lu.lf(Unknown Source)
com.aspose.pdf.internal.l2h.lu.lI(Unknown Source)
com.aspose.pdf.devices.lI.lI(Unknown Source)
com.aspose.pdf.devices.TiffDevice.processInternal(Unknown Source)
com.aspose.pdf.devices.DocumentDevice.processInternal(Unknown Source)
com.aspose.pdf.devices.DocumentDevice.process(Unknown Source)
com.stormed.common.utils.ImageUtils.pdfToTiffAspose(ImageUtils.java:204)
com.stormed.ocr.tesseract.PdfConvertTiff.getTiffs(PdfConvertTiff.java:25)
com.stormed.ocr.tesseract.Ocr.ocrextracted(Ocr.java:30)
com.stormed.ocr.OcrEpisodeII_Tesseract.ocr(OcrEpisodeII_Tesseract.java:22)
com.stormed.ocr.OcrMain.(OcrMain.java:94)
com.stormed.ocr.common.OcrBuilder.run(OcrBuilder.java:49)
com.stormed.proxy.AppRunner.run(AppRunner.java:21)
com.stormed.proxy.ProxyMain.runApp(ProxyMain.java:223)
com.stormed.proxy.ProxyMain.lambda$main$0(ProxyMain.java:115)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748) at com.aspose.pdf.internal.l10t.le.lI(Unknown Source)
at com.aspose.pdf.internal.l10t.le.lI(Unknown Source) at com.aspose.pdf.internal.l3k.lI.lI(Unknown Source)
… 21 more Caused by: java.lang.OutOfMemoryError: Java heap space
Any insight into why the drawing class above or just side effect of the heap space error?
Code Snipit:
try {
pdfDocument = new Document(inputFilePath);
imageStream = new FileOutputStream(outputFilePath);
Resolution resolution = new Resolution(DEFAULT_DPI_RESOLUTION); // abstract resolution that seems to correlate to dots per inch (DPI)
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(compressingType);
tiffSettings.setDepth(colorDepth);
tiffSettings.setSkipBlankPages(false);
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
**tiffDevice.process((IDocument) pdfDocument, imageStream);**
pdfDocument.close();
} finally {
if(pdfDocument != null ){
pdfDocument.close();
}
if(imageStream != null) {
imageStream.close();
}
Attached Sample File.
SMH.PC.00000001.pdf (1.2 MB)