Word to PDF Error

Converting Word to PDF generates this error when opening the PDF in IE
"Adobe Acrobat, File does not begin with ‘%PDF-’,
and this error when opening directly with Acrobat
“Adobe Reader could not open ‘437.1.pdf’ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn’t correctly decoded).”
I was using the XML method which worked OK but took a long time to process.
My code: (less the license lines)

private static void SaveWordAsPdf(string baseFilePath, string filePath)
{
    // string xmlFilePath = String.Format( CultureInfo.CurrentCulture, @"{0}.{1}", baseFilePath, "xml" );
    string pdfFilePath = String.Format(CultureInfo.CurrentCulture, @"{0}.{1}", baseFilePath, "pdf");
    Aspose.Words.Document doc;
    try
    {
        doc = new Aspose.Words.Document(filePath);
        doc.Save(pdfFilePath/*xmlFilePath*/, Aspose.Words.SaveFormat.AsposePdf);
    }
    finally
    {
        doc = null;
    }
    // CreatePdfFile( xmlFilePath, pdfFilePath );
}

Hi

Thanks for your request. Which version of Aspose.Words and Aspose.Pdf are you using?
Currently Aspose.Words supported two ways of PDF conversion: direct conversion (without using Aspose.Pdf) and legacy conversion Aspose.Words+Aspose.Pdf. See the following link for more information:
https://docs.aspose.com/words/net/convert-a-document-to-pdf/
So, you can try using new method to convert your document to PDF. Here is the code:

Document doc = new Document("in.doc");
doc.SaveToPdf("out.pdf");

Best regards.

Fixed.
Thanks. Aspose.Words 6.2.0 using .SaveToPDF() did the trick.
Thanks, Thanks, Thanks