Hello,
I’m experiencing a critical issue where Document.save() hangs indefinitely during DOCX to PDF conversion. The process never completes, no timeout occurs, and no warnings are reported.
Environment:
build.gradle
implementation(group: ‘com.aspose’, name: ‘aspose-words’, version: ‘25.2’,classifier: ‘jdk17’)
- Operating System: Linux (server), Windows (local development)
- Document language: Azerbaijani (Latin alphabet - characters include: ə, ö, ü, ğ, ı, ş, ç)
- Document font: Arial
Problem Description:
When converting specific DOCX documents to PDF, the save operation hangs indefinitely with no error or warning:
Document doc = new Document(inputStream);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// Hangs here indefinitely - never completes, never throws exception
doc.save(outputStream, SaveFormat.PDF);
Attachments:
- Sample DOCX file that reproduces the issue
The same conversion code works perfectly with other documents. Only specific documents cause this hang.
2be355ca-51d7-11ec-bb38-33d8b5a0df9d.DOCX (13.4 KB)
The same document converts successfully using Aspose’s online converter (Convert DOCX To PDF Online), but hangs indefinitely in our code.
This raises important questions:
- What configuration or settings does the online converter use that we’re missing?
- Is this a document issue or are we not using the API correctly?
- Are there specific settings, font handling, or rendering options the online converter uses that we should implement?
We would greatly appreciate your assistance in resolving this critical issue.
Thank you very much for your help.
@aygun.safar
You mentioned that Document.save() never returns when converting a particular DOCX file to PDF with Aspose.Words for Java 25.2 (JDK 17 classifier), while the same file converts fine with the online Aspose converter and other DOCX files work correctly in your code .
Things you can try
- Update the library – install the latest Aspose.Words for Java release and test the same file. Newer builds often contain fixes for rendering‑related problems.
- Force a known font – if the document uses Azerbaijani characters, set a default font (e.g., Arial) before saving:
FontSettings fs = new FontSettings();
fs.setDefaultFontName("Arial");
doc.setFontSettings(fs);
doc.save(outputStream, SaveFormat.PDF);
- Use PDF save options with memory optimisation – this can help on Linux environments:
PdfSaveOptions opts = new PdfSaveOptions();
opts.setMemoryOptimization(true);
doc.save(outputStream, opts);
- Enable Aspose internal logging to see how far the conversion proceeds:
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("com.aspose.words");
logger.setLevel(java.util.logging.Level.FINE);
Review the generated log for the last completed step before the hang.
- Check the execution environment – confirm the Java version (
java -version), OS distribution, and whether the hang occurs on both Linux and Windows. Also verify that no custom code (e.g., document manipulation, warning callbacks) runs just before doc.save().
Information we need to investigate further
- A copy of the DOCX file that reproduces the hang (please re‑upload or provide a download link).
- The exact Java runtime version and OS details (Linux distribution, kernel version, Windows version).
- Whether the issue appears on both platforms or only on one.
- Any additional code that interacts with the
Document before the save call.
Providing the file and the log output from the steps above will allow us to determine whether this is a document‑specific problem or a library issue and to suggest a more precise solution.
@aygun.safar The problem is not reproducible on my side using the latest 26.1 version of Aspose.Words for Java. Please try using the latest version and let us know if the problem still persists on your side.
Also, A3 Times AzLat is not available on my side. Could you please attach it here for testing, just in case it is the reason of the problem on your side.
Thank you for investigating this issue!
it works perfectly with version 26.1 The conversion completes successfully without any hangs.
What was the root cause of the hang in version 25.2?
Thank you again for the quick resolution!
@aygun.safar
Unfortunately, it is hard to answer the question. Each new version of Aspose.Words contains about 80 fixes and improvements. Most likely some of these fixes made since 25.2 resolved the problem with your document.
1 Like
I understood. Thank you for your support
1 Like