Aspose PDF save method stuck permanently

I am struggling with the ASPOSE pdf, method, here its getting saved to a stream.
For the below code whenever the html fragment gets added in document object the method gets stuck forever.
Here processedHtml is a string html.
Document doc = new Document();
HtmlFragment htmlFragment = new HtmlFragment(processedHtml);
HtmlLoadOptions options = new HtmlLoadOptions();
// Set Print or Screen mode
// Save the document to a memory stream
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();;
The control never gets beyond method, the program is stuck at method.
// Get the byte array from the output stream
byte[] pdfBytes = outputStream.toByteArray();

I am using java 17, -Xms3000m -Xmx3500m, it’s part of spring boot. The aspose version for pdf that I have tried : 23.12, 23.7, 21.1, for all of these versions the control is getting stuck when doc object is copying the data to memory stream. I have tried increasing the memory, codec buffer nothing helped.

My most of the productivity time gets into fixing such ASPOSE ISSUES.



We tested the code snippet with both JDK 17 and JDK 1.8 but could not reproduce the issue that you mentioned. We used 24.1 version of the API. Can you please try using it and if issue persists, please share a sample console application for our reference in .zip format so that we can again test and address it accordingly.

I can see the very latest version is 23.12, at Aspose.PDF | Java PDF Document Processing Class Library. I am using aspose-pdf api.


Please check and download the latest version from this link. You can also update your pom.xml accordingly.