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

Free Support Forum - aspose.com

Browser unhappy with pdf stream made from docx stream

Currently my software has an endpoint that returns a document stream, which when hits opens MS Word. Using Aspose.Words I created another endpoint which the document stream is changed into a pdf stream. The conversion is done below, and this was shown as the procedure in an example

docStream = generator.Generate(entityId, customProperties); <- original document stream
Aspose.Words.Document doc = new Aspose.Words.Document(docStream);
doc.Save(docStream, Aspose.Words.SaveFormat.Pdf); <- now docStream should be a proper pdf stream

The issue that is occurring is that the pdf being returned to the browser will only open in firefox. IE gives an error, “File does not start with ‘%PDF-’. Local\EWH-17432-0.” Chrome just says, "Failed to load PDF document."

Also worth mentioning, the response from the server does have the content header “application/pdf”

Hi David,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to generate your output document
  • Please attach the output Pdf file that shows the undesired behavior.

As soon as you get these pieces of information to us we'll start our investigation into your issue.