Hi Wasim,Itsak26:Could you please share the converted PDF.
Hi Wasim,
…<o:p></o:p>
image.setBlackWhite(true);
....
Furthermore increasing java heap memory size as following will also enhance the performance.
Xmx1024m -Xms1024m
Please feel free to contact us for any further assistance.
Best Regards,
Hi,
I installed latest Aspose PDF library 11.0 and below is the observation,
1. Time taken to generate the PDF is reduced considerably. File got converted within a minute.
2. The size of the generated PDF is at par with the source image file.
Thanks so much for fixing these issues.
But still the memory taken for this conversion is too much and CPU utilization also reaching very high about 60-70% during conversion.
I have already set JVM to max 1024 MB in 32 bit JVM env.
I had also tried some “CacheOndiskOnly” method which was suggested earlier but that didnt work.
Can you please look into high memory and CPU usage?
Thanks,
Wasim
Hi Waseem,
Hi again,
Yes the CPU utilization remains high only for some time but the other issue I mentioned is of memory consumption.
It is now seen as after processing 5-6 files of such kind, the memory consumption goes to the maximum available RAM ( 1GB in this case) and after that the applications just stops processing any more file.
Once the file is processed, memory used should come down to normal usage value similar to CPU utilization, isnt it?
Can we avoid the RAM being used to load the image pixels into PDF something like “cacheondiskonly” solution?
Please look into it urgently as we are again stuck to the issue where files are not getting processed albeit after some time now after your fix.
Thanks,
Wasim
Hi Tilal,
com.aspose.pdf.MemoryCleaner.clear() doesn’t seem to clear the memory as memory taken to process Tiff remains high even after PDF is generated.
Here is the thing
1) I tried setBlackWhite as true, it works for the size and time issue but memory taken up is too high and eventually the applications goes in hanging mode.
2) I tried converting multipage tiff to Jpeg images and generating PDF from jpeg. Still the same memory issue.
3) I tried scaling down the tiff frames at compromise of quality. It works for some time and delays the inevitable but application still hangs albeit after processing more number of files compared to point 1 above.
Therefore, I am requesting you yet again for the issue which I faced more than one year back and notified the support team. My application still hangs during high resolution multipage tiff file to PDF conversion.
Please mark this request as urgent and fix as soon as possible. We are in critical stage of our project and hope that this issue would not need further escalation.
Thanks,
Wasim
Hi Wasim,
Hi,
Sample file attached. <Test 100009387.tif>
Please check the memory consumption before and after the attached file processing in the application.
How to verify whether memory has been released or not post method call? I can see from Task Manager Memory consumed by the application remains high post Tiff processing and method call.
Aspose PDF version is aspose.pdf-11.0.0.jar.
Thanks,
Wasim
Hi Wasim,
Hi,
Sharing again,
Regarding ‘after completion of the processing’ and not completion of the application, right?
As I stated earlier, eventually the process gets stuck not immediately after processing. So yes, I am talking about the times well after the processing is complete.
Thanks
Wasim
Itsak26:
Sharing again,
com.aspose.pdf.Document doc = new com.aspose.pdf.Document();
doc.getPages().add();
com.aspose.pdf.Image image = new com.aspose.pdf.Image();
image.setFile("C:\\Users\\Home\\Downloads\\Test+100009387.tif");
image.setBlackWhite(true);
doc.getPages().get_Item(1).getParagraphs().add(image);
Itsak26:
Regarding 'after completion of the processing' and not completion of the application, right?
As I stated earlier, eventually the process gets stuck not immediately after processing. So yes, I am talking about the times well after the processing is complete.
Hi Waseem,
Hi Waseem,
Hi,
Whats the status of the ticket #35793? Is there a tracking tool where I can see the update?
Thanks,
Wasim
Hi Wasim,
byte[] array = new byte[1024 * 1024 * 680];<o:p></o:p>
then clean the object by assigning it null and running your sample code 20 times. Finally We created the same big object in the memory again. Taking into account JVM caching we have reduced the array size in 30 mb. And we were able to create the object. Which means that the memory is free and available for use.
The full code snippet is as following:
//Enabled Java options: -Xmx1024m
-Xms1024m<o:p></o:p>
byte[] array = new byte[1024 * 1024 * 680];<o:p></o:p>
printMemoryStatus(“init”);<o:p></o:p>
array = null;<o:p></o:p>
for (int i = 0; i < 20;
i++)<o:p></o:p>
{<o:p></o:p>
//
license initialization<o:p></o:p>
init();<o:p></o:p>
// logger.info(“Process Tiff
attachment with latest lib fix 19/04/2016.”);<o:p></o:p>
com.aspose.pdf.Document doc = new com.aspose.pdf.Document();<o:p></o:p>
doc.getPages().add();<o:p></o:p>
com.aspose.pdf.Image image = new com.aspose.pdf.Image();<o:p></o:p>
image.setFile(myDir + “Test+100009387.tif”);<o:p></o:p>
// logger.info("TIFF file name:
" + fileName);<o:p></o:p>
image.setBlackWhite(true);<o:p></o:p>
doc.getPages().get_Item(1).getParagraphs().add(image);<o:p></o:p>
doc.save(myDir + “Test+100009387.pdf”);<o:p></o:p>
// At the end of method, I am calling
these,<o:p></o:p>
doc.close();<o:p></o:p>
com.aspose.pdf.MemoryCleaner.clear();<o:p></o:p>
com.aspose.pdf.MemoryCleaner.clearAllTempFiles();<o:p></o:p>
com.aspose.pdf.MemoryCleaner.clearFontRegistry();<o:p></o:p>
com.aspose.pdf.MemoryCleaner.clearLicense();<o:p></o:p>
doc = null;<o:p></o:p>
image = null;<o:p></o:p>
}<o:p></o:p>
printMemoryStatus(“after
Aspose.Pdf”);<o:p></o:p>
array = new byte[1024 * 1024 * 650];<o:p></o:p>
printMemoryStatus(“after
creating new array”);<o:p></o:p>
array = null;<o:p></o:p>
<o:p> </o:p>
----
<o:p> </o:p>
static void
printMemoryStatus(String position)<o:p></o:p>
{<o:p></o:p>
Runtime rt = Runtime.getRuntime();<o:p></o:p>
long max = rt.maxMemory()
/ 1048576;<o:p></o:p>
long total =
rt.totalMemory() / 1048576;<o:p></o:p>
long free =
rt.freeMemory() / 1048576;<o:p></o:p>
long used = total - free;<o:p></o:p>
System.out.println(“Memory status for “+position+”:
\n\tenabled\t used\t free\n\t” + max + "\t " + used + " \t
" + free);<o:p></o:p>
}
Best Regards,