We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words.FileCorruptedException is thrown while loading DOCX using Java

Hi Team,

Getting the following exception while converting word to pdf .

Exception in thread "main" com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
	at com.aspose.words.FileFormatUtil.zzY(Unknown Source)
	at com.aspose.words.Document.zzY(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.sirionlabs.clauselibrary.templateformatting.service.DocCreationService.main(DocCreationService.java:989)
Caused by: java.lang.IllegalArgumentException: Specified argument was out of the range of valid values.
Parameter name: value
	at com.aspose.words.ListLevel.setStartAt(Unknown Source)
	at com.aspose.words.zz29.zzZL(Unknown Source)
	at com.aspose.words.zz29.zzD(Unknown Source)
	at com.aspose.words.zz2W.zzKN(Unknown Source)
	at com.aspose.words.zz25.zzZu1(Unknown Source)
	at com.aspose.words.zz25.zzKN(Unknown Source)
	at com.aspose.words.zzYYV.zzKN(Unknown Source)
	at com.aspose.words.Document.zzY(Unknown Source)
	... 4 more

Checked with aspose word version 21.2 and 21.4.

Code :

com.aspose.words.License license = new com.aspose.words.License();
license.setLicense("/home/sauravarora/aspose-licence");
com.aspose.pdf.License license1 = new com.aspose.pdf.License();
license1.setLicense("/home/sauravarora/aspose-licence");
//Document document = new Document("/home/sauravarora/Downloads/WCP Franchise Agreement - Volume 2_Interim Version.docx");
Document document = new Document("/home/sauravarora/Downloads/test.docx");
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setTextCompression(PdfTextCompression.FLATE);
pdfSaveOptions.setUseCoreFonts(true);
pdfSaveOptions.setImageCompression(PdfImageCompression.JPEG);
pdfSaveOptions.setJpegQuality(60);
pdfSaveOptions.setSaveFormat(SaveFormat.PDF);
document.save("/home/sauravarora/test.pdf", pdfSaveOptions);

Attaching document :

test.docx.zip (1.2 MB)

Please check this on priority.

@saurabh.arora

We have logged this problem in our issue tracking system as WORDSNET-22115. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-22115) have been fixed in this Aspose.Words for .NET 21.5 update and this Aspose.Words for Java 21.5 update.

A post was split to a new topic: Aspose.Words.FileCorruptedException is thrown while loading document

A post was merged into an existing topic: Aspose.Words.FileCorruptedException is thrown while loading document