I have a Docx that i want to convert to PDF.
When i call the “new Document()”, i get the following error :
Exception in thread "main" com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.zzWew(Unknown Source)
at com.aspose.words.Document.zzaQ(Unknown Source)
at com.aspose.words.Document.zzXDk(Unknown Source)
at com.aspose.words.Document.<init>(Unknown Source)
at com.aspose.words.Document.<init>(Unknown Source)
at testCP.testConvertDocxToPDF.main(testConvertDocxToPDF.java:20)
Caused by: java.lang.NullPointerException: Cannot invoke "com.aspose.words.Section.getBody()" because the return value of "com.aspose.words.Document.getLastSection()" is null
at com.aspose.words.zz2A.zzXDk(Unknown Source)
at com.aspose.words.zz2A.zzWoU(Unknown Source)
at com.aspose.words.zz2A.zzHD(Unknown Source)
at com.aspose.words.zzWll.zzYuD(Unknown Source)
at com.aspose.words.zzWll.zzHD(Unknown Source)
at com.aspose.words.zzYVL.zzHD(Unknown Source)
at com.aspose.words.Document.zzaQ(Unknown Source)
... 4 more
The error you are encountering, FileCorruptedException, indicates that the DOCX file you are trying to load may be corrupted or not in a valid format. Here are some steps you can take to troubleshoot and resolve this issue:
Check the Document: Open the DOCX file in Microsoft Word or another compatible word processor to see if it opens without any issues. If it does not open, the file may indeed be corrupted.
Recreate the Document: If the document is corrupted, try recreating it from scratch or using a backup version if available.
Verify License Application: Since you mentioned that the error occurs only when using the Aspose license, ensure that the license is correctly applied in your code. Double-check the license application code to confirm it is set up properly.
Check for Updates: Ensure that you are using the latest version of Aspose.Words, as updates may include bug fixes and improvements that could resolve your issue.
Contact Support: If none of the above solutions work, consider reaching out to Aspose support with the problematic document for further assistance.
If you can provide more details about the document or any specific changes made before the error occurred, I may be able to offer more targeted advice.
@pkvogt
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28630
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@pkvogt Yes, we have already resolved the problem. The fix will be included into the next 25.10 version of Aspose.Words. We will keep you informed and let you know once it is released.