Save Word file to PDF

I’m on Aspose.Words 5.2.

I’ve seen various examples of how to save a doc as a PDF in these forums, but these methods don’t seem to apply to me:

  • doc.Save(“blah.pdf”) - does not work, it’ s not a real PDF
  • None of the Save() overloads seem to work.
  • I saw a saveToPdf answer in one forum; this function does not exist.

Ideas?

Sorry for the old version, but I’m unable to upgrade right now.

Hi
Thanks for your request. Old versions of Aspose.Words do not support direct to PDF conversion. So you have to use Aspose.Words in combination with Aspose.Pdf to achieve this. Code should look like this:

Document doc = new Document("in.doc");
doc.Save("out.xml", SaveFormat.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML("out.xml", null);
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.Save("out.pdf");

If you do not have a license for Aspose.Pdf, I would better suggest you to upgrade to the latest version of Aspose.Words and use direct to PDF method as described here:
https://docs.aspose.com/words/net/convert-a-document-to-pdf/
Best regards,

Don’t have Aspose.Pdf.

So I guess we’re out of luck right now.

Unfortunately, using this version of Aspose.Words you cannot convert a document to PDF without Aspose.Pdf. So you should upgrade if you need this feature.
Best regards,