Free Support Forum -

Aspose PDF Generation - Memory of Worker Process


I am using Aspose.pdf (Version: I am using the below mentioned code for generating PDF and Opening it using memory stream. I need to know how much memory of worker process is taken while using memory stream approach, as if there are 1000 users downloading the same PDF at a time? or is there any other better way to open the file? Not saving the file… Please help on this.

StreamReader r = File.OpenText(filepath);
string htmlToRender = r.ReadToEnd();
var pdf = new Pdf();
MemoryStream memStream = htmlToRender;
Response.ContentType = “application/octet-stream”;
Response.AddHeader(“Content-Disposition”, “attachment;filename=Statements.pdf”);

Hi Venkat,

Thanks for your interest in our products and sorry for the delayed response.

The amount of memory utilization depends upon the contents and size of PDF document being generated. Furthermore the amount of time being utilized for PDF generation also depends upon the size of objects being placed inside PDF file. If you are facing particular delay or any other performance issue while creating and loading PDF files, please share some sample project so that we can test the scenario at our end.

Thanks for your response!

When considering the data, its just a static data with some statements not exceeding the page limit of 5. The question is even if it a small data, i need to know, “to open a file”, we are using Memory stream. Is there any other approach other than Memory Stream for a faster performance if the user limit is 1000 downloading the file at same time.

Hi Venkat,

As per my understanding, you need to add string information inside existing PDF document so every time a user requests, the file needs to be loaded into MemoryStream and then appropriate text is added. I think once the file is loaded, you can hold it in memory and use the stream object for all user requests. This will save the time for re-load the document on every request.

Besides this, if you need to generate the PDF file from scratch, you may follow the approach of Writing PDF directly. When using this approach, the PDF generation time is further reduced. In case you encounter any issue or you have any further query, please feel free to contact.