I am trying to open a PDF file using com.aspose.words.Document and save it as docx file using “aspose-words-20.11-jdk17.jar”.
Document pdfDocument = new Document(“TestDoc.pdf”);
When code executes above line, it throws following exception
com.aspose.words.UnsupportedFileFormatException: Unsupported file format: Unknown
at com.aspose.words.zzX.zzZ(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
On the other hand, same code will work well in aspose word for dotnet and can also save PDF file in docx format successfully. However, in aspose word jar for java it failes and throws the above error.
Kindly suggest how can I open pdf file using aspose.words jar and save it as docx file?