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

Free Support Forum - aspose.com

Generated PDF is Corrupt

We have two processes that creates letters in merges data with a Microsoft Word Template and converts to PDF: via windows service and via website. We recently upgraded the version of Aspose:

Aspose.Words: 16.1.0.0 >>>> 20.6.0.0
Aspose.Pdf: 11.3.0.0 >>>> 20.6.0.0

Both share the same class file for generating the PDF documents. However, when the website creates the PDF documents, the files are not able to be open via Adobe Reader. We receive an error stating that the file is corrupt. However, the PDF file can be opened in Microsoft Edge and Chrome. Exact Error message we receive is

“There was an error opening this document. The file is damaged and could not be repaired.”

Below is the code for adding the PDF to the Response object:

Response.Clear();
Response.ContentType = “application/pdf”;
Response.AddHeader(“Content-Disposition”, “attachment; filename=x.pdf”);
Response.BinaryWrite(<object.Document>); <document is a byte[ ] property
Response.OutputStream.Flush();
Response.OutputStream.Close();

Before upgrading the license, we did not have any issues. Any idea what could be causing the PDF files to be corrupt?

Thank You

@bfmcfarlaneDXC

Are you facing the issue with PDF files generated from Aspose.Words? Are you converting .doc/docx files into PDF? Please share the code for generating PDF files along with sample source files. We will test the scenario in our environment and address it accordingly.