Converted PDF is not readable by Adobe Acrobat

compliance_letter-AA241 (4).pdf (214.9 KB)
Hi,

We have been using Aspose Words for .NET for quite a few years. One of the ways we use it is to create a template in Word, use Aspose to update specific information in the template and then save the doc as a pdf so a user can download from a browser. This has been working great until recently. I just noticed that the generated pdfs are no longer readable by Adobe Acrobat. however, the file is readable and looks fine using the Google Chrome reader. We have not changed anything on our side other than upgrading to the latest release of Aspose Words 17.8.0. I have attached a sample file.

Thanks,

Scott Butler

@scottbutler,

Thanks for your inquiry. Please ZIP and attach the following resources to the post for testing. We will look into these and will guide you accordingly.

  • Share your input Word document
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end.

Please see attached. Interestingly, the console application save works fine. It is the save to web that creates the issue. Note that it reads fine in Google Chrome but not in the latest versions of Adobe Reader or Adobe Acrobat Pro (17.0.12.xxx) on the PC. I did remove the license file from both projects before zipping and sending. Also, the template file is embedded in both projects.AsposeTest.zip (34.1 KB)
AsposeTestWeb.zip (540.3 KB)

@scottbutler

Thanks for sharing the sample projects. I am afraid I am unable to compile your AsposeTestWeb project. After updating the references from NuGet I am getting following error. I tried to fix it but no success. Can you please share your sample project without compilation error? You can upload your complete project to some free file sharing service e.g. Dropbox or Google Drive etc. It will help us to reproduce your issue exactly and address it accordingly.

Furthermore, please confirm which version of Aspose.Words was working fine at your end.

“The missing file is …\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.”

Hi,

I am using Visual Studio 2015 Enterprise. The project I sent to you was just a generic web project and then I added the code to demonstrate the issue using the button handler. A quick web search found this article

I do use Xamarin but obviously not in this project.

Not sure on the Aspose Words version. Latest does not work. I will have to test and get back to you on the latest version that works.

@scottbutler

Thanks for your feedback. I have already tried these options. However, I have created a new web project using your sample code and resources and managed to reproduce the issue. It is working fine with 17.7. I have logged a regression ticket WORDSNET-15816 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

@scottbutler

Thanks for your patience. We have investigated the issue, please add Reponse.End() after sending document to a client browser as shown in the following code, it will resolve the issue.

Document doc = new Document(@"Compliance Letter Template.docx");
doc.Save(HttpContext.Current.Response, "output.pdf", ContentDisposition.Attachment, SaveOptions.CreateSaveOptions(SaveFormat.Pdf));
HttpContext.Current.Response.End();

Any update on this issue?

@scottbutler

Thanks for your inquiry. As suggested above, you need to use Response.End() method after sending document to client browser.

Just saw this. For some reason, I don’t seem to be getting notifications when you respond.

This is a really crummy solution. Calling Response.End() causes the TrheadAbortException to be thrown and screws up the code. Please fix so this is not necessary.

@scottbutler

Thanks for your feedback. We have shared your concern with our product team and logged another issue WORDSNET-16051 for further investigation and resolution. We will keep you updated about the issue resolution progress within this forum thread.

@scottbutler

Thanks for your patience. As suggested in stackoverflow post, please use following code instead of Response.End() method. It will help you to resolve the issue.

HttpContext.Current.Response.Flush();
HttpContext.Current.Response.SuppressContent = true;
HttpContext.Current.ApplicationInstance.CompleteRequest();