Free Support Forum - aspose.com

Save as PDF cannot be opened with Reader version 11.0.2

after opening a DOCX doing some simple Range.Replace calls and Save. The resulting PDF cannot be opened by Adobe Reader X. I can with the Windows 8 reader. I got the latest DLL, version 13.3.0.1, but get the same result. Reader states the file is either not a supported file type or has been damaged.

Code snippet:

Aspose.Words.Document doc = new Aspose.Words.Document(template);
var todayDate = DateTime.UtcNow.FromUTCToCentralTime().ToString("dddd, MMMM dd, yyyy");
doc.Range.Replace(TODAYS_DATE, todayDate, true, true);
doc.Range.Replace(EMPLOYER_NAME, loan.Customer.Employer.Name, true, true);
doc.Save(template, SaveFormat.Pdf);

Note: this is the trial edition of Words if that make a difference. Need to validate function before purchase but failure to open PDF with Adobe Reader is a NO GO.

Hi Gary,

Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

example template attached

Hi Gary,


Thanks for sharing the document. I have tested the scenario by using following code snippet and have not found the shared issue. I have attached the output Pdf file with this post for your kind reference.

Document doc = new
Document(MyDir + “Template.docx”);<o:p></o:p>

var todayDate = DateTime.UtcNow.ToString("dddd, MMMM dd, yyyy");

doc.Range.Replace("TODAYDATE", todayDate, true, true);

doc.Range.Replace("EMPLOYERNAME", "EMP NAME", true, true);

doc.Save(MyDir + "Out.pdf");


Please share the following details for further investigation.


What environment are you running on?

  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • .NET Framework version
  • Please supply us with the output document showing the undesired behavior

Thanks. I attached the PDF I created. Please try to view with Adobe Reader. I also attach a screenshot of the error from Adobe I encountered.

One difference in the code I am using versus yours is: I am using the Aspose.Words.Document constructor that takes a Stream argument and passing a MemoryStream instance. I am also using the Save method overload with the MemoryStream instance and the SaveFormat.Pdf enum.

My OS in Windows Server 2012 64bit

NET version 4.5

Aspose.Words version 13.3.0.1 (trial download)

BTW: I can view the PDF with the Windows 8 PDF reader app, but not Adobe Reader if that helps any.

Hi Gary,


Thanks for sharing the detail. I have tested the scenario by using following code snippet and have not found the shared issue.

// Open the stream. Read only access is
enough for Aspose.Words to load a document.
<o:p></o:p>

Stream stream = File.OpenRead(MyDir + "Template.docx");

// Load the entire document into memory.

Document doc = new Document(stream);

var todayDate = DateTime.UtcNow.ToString("dddd, MMMM dd, yyyy");

doc.Range.Replace("TODAYDATE", todayDate, true, true);

doc.Range.Replace("EMPLOYERNAME", "EMP NAME", true, true);

doc.Save(MyDir + "Out.pdf");

// You can close the stream now, it is no longer needed because the document is in memory.

stream.Close();



  • Please make sure that you are using the latest version of Aspose.Words for .NET 13.3.0.1.
  • Could you please check this issue at some differnt system and share your findings with us?
  • Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (PDF, XPS or SWF). Make sure you have all the Fonts installed on the machine you're using to convert Word document to PDF format.
I would suggest you please read the following article:

Thanks for looking in to this. I found the issue related to the Save to an output stream.

I changed the save code to be

var output = new MemoryStream();
doc.Save(output, SaveFormat.Pdf);
return output;

Using a new stream resolved the issue, where previously reusing the caused the contents to be unreadable by Adobe Reader.

Problem solved.

Hi Gary,


Thanks for your feedback. It is nice to hear from you that you have solved your problem. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.