We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Did not convert from memory stream to pdf If memory stream have some graph/chart

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();

@anand.nagar Could you please attach your problematic document and output here for testing? We will check the issue and provide you more information.

Main Office.docx (50.5 KB)

@Konstantin.Kornilov I have uploaded document which gives me error and not converting to pdf properly.
Thanks for reply.

@anand.nagar Thank you for additional information. I have checked the conversion on my side and the output PDF works fine on my side. I can open and view it using Acrobat Reader. Could you please attach your output PDF document here for our reference?
I have used the latest 22.11 version of Aspose.Words for testing? here is the output produced on my side: out.pdf (53.1 KB)

I am using 18.0 verson

@anand.nagar Thank you for additional information. 18.x version has been released more than 4 years ago. Please try using the latest version of Aspose.Words and let us know if the problem still persist on your side. And if so, please create a simple application that will allow us to reproduce it.