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.