Document word to Pdf

Hi all I’, trying to convert a document word to Pdf but have an error “file does not begin with ’ pdf-’ local ewh” I’m using.

public static byte[] convertDoctoPdfByte(byte[] document)
{
MemoryStream stream = new MemoryStream(document);
Document pdfDocument = new Aspose.Words.Document(stream);
stream.Close();

MemoryStream pdfStream = new MemoryStream();
pdfDocument.Save(pdfStream,Aspose.Words.SaveFormat.AsposePdf);
return pdfStream.ToArray();
}

Any suggestion please, thanks.

Hi,


Thanks for your inquiry. Could you please attach your input Word document you’re getting this problem with here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Of course, I attached my example file.

I have the version 5.1.0.0 of Aspose.Words and version 3.6.2.0 of Aspose.Pdf
Hi,

Thanks for your inquiry. After an initial test with Aspose.Words for .NET 17.2.0, we were unable to reproduce this issue on our end (see attached 17.2.0.pdf). We would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:
http://downloads.aspose.com/words/net

Hope, this helps.

Best regards,