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

Free Support Forum - aspose.com

Unable to open a word document. com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded

Hi Team,

When i am trying to convert docx into pdf by using com.aspose.Words i am getting the follwing exception.

com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.a(FileFormatUtil.java:130)
at com.aspose.words.Document.b(Document.java:1283)
at com.aspose.words.Document.a(Document.java:1152)
at com.aspose.words.Document.(Document.java:200)
at com.aspose.words.Document.(Document.java:171)
at com.aspose.words.Document.(Document.java:166)
at Test2.wordToPdf(Test2.java:31)
at Test2.main(Test2.java:18)
Caused by: java.lang.NullPointerException
at com.aspose.words.acm.a(NrxXmlUtil.java:184)
at com.aspose.words.hu.q(DocxThemeReader.java:297)
at com.aspose.words.hu.p(DocxThemeReader.java:266)
at com.aspose.words.hu.d(DocxThemeReader.java:231)
at com.aspose.words.hu.a(DocxThemeReader.java:102)
at com.aspose.words.hu.a(DocxThemeReader.java:79)
at com.aspose.words.gd.Dq(DocxDocumentReader.java:37)
at com.aspose.words.ge.read(DocxDocumentReaderBase.java:46)
at com.aspose.words.hd.Dr(DocxReader.java:63)
at com.aspose.words.hd.read(DocxReader.java:54)
at com.aspose.words.Document.b(Document.java:1232)
… 6 more

License license = new License();
license.setLicense((new StringBuilder(String.valueOf(“Licece name”);
Document doc = new Document(inputPath);

My source docx document is attached

i am using all latest jars

java version is 1.6
Environment is Linux and Windows

please help!!

Thanks in Advance…

Hi Tirumala,

Thanks for your inquiry. I have tested the scenario using latest version of Aspose.Words for Java 15.7.0 and have not found the shared issue. I suggest you please upgrade to the latest version of Aspose.Words for Java 15.7.0. I have attached the output document with this post for your kind reference.

Hi Tahir ,

Thanks for your response.I have tested with Aspose.Words for Java 15.7.0 the issue is not resolved. i am getting same error.can you please provide me code snippet if possible, so that i can find where i went wrong.
As of now i am trying with the below code

License license = new License();
license.setLicense((Licence name);
Document doc = new Document(input);

i have attached the screen what jars i am using for your reference.

Hi Tirumala,


for your inquiry. Please make sure that you are using the same document
which you attached in this forum thread. I have used the following code
example to test this scenario.

Could you please share your
environment detail e.g Operating system, Jdk version (32 bit or 64 bit)?
Please download the document from this forum thread and test the same
scenario at your side and share your findings here for our reference?

Document doc = new Document(MyDir + "test doc.docx");

doc.save(MyDir + "Out.pdf");

Thanks. Working fine.

Hi Tirumala,


for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.