I am using the below code to convert pdf from a word document/memory stream. but when I try to open the pdf which is generated by code the PDF did not open and shows the message “We can not open this file…something went wrong.” Please help me to sort out that issue.
MemoryStream objMemoryStream = new MemoryStream(document.FileData);
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(licensePath);
Aspose.Words.Document doc = new Aspose.Words.Document(objMemoryStream);
Aspose.Words.Saving.PdfSaveOptions saveOption = new Aspose.Words.Saving.PdfSaveOptions
{
Compliance = Aspose.Words.Saving.PdfCompliance.PdfA1b,
SaveFormat = Aspose.Words.SaveFormat.Pdf,
MemoryOptimization = true
};
doc.Save(tempFilePath, saveOption);
objMemoryStream.Dispose();