Free Support Forum - aspose.com

Import PDF into Aspose.Words' DOM using Java

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?

@gurushantb

Unfortunately, Aspose.Words for Java does not import PDF into its DOM. We logged this feature request as WORDSJAVA-2511 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.