We are using Aspose.Words to create and/or update word documents and save them, it works great, however we would like to be able to save as PDF as well. When we purchased the product we were under the impression this would work, if we get the Aspose.PDF license as well as the Aspose.Words product will the following be possible?
Document doc = new Document()
…
doc.save("word.doc");
doc.save("adobe.pdf");
Thanks for your request. Currently Aspose.Words supports direct conversion to PDF (without using Aspose.Pdf). See the following link for more information:
So, you can try using direct method to convert your document to PDF. Here is the code:
Document doc = new Document("in.doc");
doc.SaveToPdf("out.pdf");
I Must be missing something as there appears to be no Document.saveToPdf() function. I have double checked the documentation and it does not show there is a saveToPdf method either.
I downloaded a fresh version of aspose words yesterday so I must have the right version, the jar is called “Aspose.Words.jdk16.jar”
So I have tried making a test class to try to get it to work, the following results in generating a doc, but not a pdf:
Document doc = new Document()
//… add some test stuff…
doc.save(“test.doc”);
doc.save(“test.pdf”);
When it gets to the pdf it says:
java.lang.UnsupportedOperationException: Unsupported SaveFormat: .pdf
at com.aspose.words.Document.save(Document.java:912)
at com.aspose.words.Document.save(Document.java:859)
at Test2.create(Test2.java:79)
at Test2.main(Test2.java:49)
Thanks for your request. This feature is currently in beta, that is why it is not described in the documentation. However, it is described on in the download notes of the latest version:
Please make sure you are using the latest version. To check version of Aspose.Words for java, unzip Aspose.Words.jar, open META-INF\ MANIFEST.MF file in notepad, you will see the following: