PDF.Save - Thread was being aborted

Hello, had a quick question. In the Aspose.Pdf.Generator.Pdf.Save(string fileName, SaveType saveType, HttpResponse response) method there is a Response.End that is being called that is causing the application to throw a “Thread was being aborted” exception. The pdf generates fine, but since the exception is thrown, no further code execution happens. Catching the exception doesnt help either. Do you please know of a work around? Thanks a lot.

@varun_nm,

You can save PDF in the stream instance, and then write this stream to the Response object. If this does not help, then kindly send all details of the scenario, including source document and code. We will investigate your scenario in our environment, and share our findings with you.

@imran.rafique,

Thanks a lot for your response. That was what I ended up doing.

@varun_nm,

There might a bug in the old version of Aspose.PDF for .NET API, and we do not provide fix in the same or old version. The Aspose.Pdf.Generator namespace is an old DOM approach which has been removed. We recommend our clients use the new DOM approach, the structure of a PDF file is hierarchical, and the new DOM approach accesses elements in the same way. In order to better understand the new DOM approach, please refer to this help topic: Introduction to the DOM API. Based on your scenario, the Save method of the Document class (new DOM approach) does not write PDF in the HttpResponse object.