Save large size PDF (2000 pages) using C# with Aspose.PDF - API is taking too long

Hi Team,
I want to create 2000 pages PDF using Aspose.pdf. When we try to convert into Memorystream , it is taking too long to convert. sometimes it is loading and not ended. Please give me some solution for this.
using(MemoryStream ms=new MemoryStream())
{
pdf.save(ms) - this line is taking more time. not even it is not ended.
}

Thanks & Regards,
Narmatha.P

@narmatha

The time taken by the API depends upon complexity and structure of the PDF document being processed or generated. Would you kindly share complete code snippet along with sample PDF document which we can use in our environment. We will try to observe the issue and address it accordingly. Also, please share your environment details e.g. OS Name and Version, Application type, Framework version, RAM size, etc.

Could you please provide some examples for how to generate Document with tables to avoid complexity of generating PDF. We are using Aspose.PDF 9.8 version

PFA code changes. Please refer “DAsposePdfWrapperUtilities.zip (5.2 KB)
efault.aspx.cs” page.

PFB my environment details.
Windows 10
Framework : .Net 4.5
RAM: 8GB Ram

I am not able to send the whole solution. Please use the files which is in Zip folder in ur solution. And please help me to resolve this problem.

Thanks & Regards,
Narmatha.P

@narmatha

Thanks for sharing requested details.

Could you please also share the stats e.g. how much time it is taking at your end and which version of the API you are using at your end?

Hi,
For 10000 data it is taking more than 7 mins… For 25000 data it is going with endless. I have waited for 15 mins and stopped .

Aspose.pdf - 9.8 version

Please help us to give solution asap.

Is there anyone else who will support from offshore hours[9AM to 7PM IST]. Because it is taking time to getting reply back. We can schedule a call and discuss on this issue if possible.

Please provide the proper way to add multiple tables into document in Aspose.pdf 9.8.

Please provide some code changes.

Thanks & Regards,
Narmatha.P

@narmatha

We apologize for the delayed response.

We would definitely try our best to reply you within the time that suits you. Regretfully, forums are the only station where we encourage providing support.

Nevertheless, we have tested the scenario using Aspose.PDF for .NET 20.1 and observed that the API was taking long time while saving the PDF document into MemoryStream. The issue looks related to large memory consumption. You may please try saving the PDF to local disk instead. However, we have logged a quality issue as PDFNET-47632 in our issue tracking system.

We will surely look into details of this issue which is related to the performance of the API and keep you posted with the status of its correction. We request you to be patient and spare us some time.

We are sorry for the inconvenience.

Hi,
Tried saving into local drive and it is also taking more time to save for large size document.
Ex: pdf.Save(@“D:\final.pdf”, SaveFormat.Pdf);

tried both scenario, in local drive as well as saving it in memory. Both are not working for large size document

Thanks & Regards,
Narmatha.P

@narmatha

Thanks for your feedback.

We have also logged this information along with the issue and will let you know as soon as we have additional updates regarding ticket resolution. Please spare us some time.

Hi Team,
Is this issue completed at your end? Please let us know the status.

Thanks & Regards,
Narmatha.P

@narmatha

Thanks for your inquiry.

Please note that the issue has been logged recently in our issue management system and is pending for analysis. Issues under free support model have low priority and are resolved on first come first serve basis. Furthermore, performance-related issues are complex in nature and need more time to get resolved. We will surely inform you as soon as we have some additional updates regarding issue resolution. Please spare us some time.

We are sorry for the inconvenience.

Hi Team,
Is there any improvement in analyzing the performance issue at your end?. Keep us posted, so that we can know the status of this issue.

Thanks & Regards,
Narmatha.P

@narmatha

Thanks for your inquiry.

We are afraid that no progress has been made towards issue resolution yet. Please note that performance related issues are complex in nature and need more time for investigation. We will surely take care of your concerns and inform you as soon as we make some progress towards ticket resolution. Please spare us some time.

We are sorry for the inconvenience.

Hi Team,
Could you please provide ETA for this issue? Because we are getting so many issues because of this performance in production.
Based on your ETA, we will discuss further for this performance issue solution.

Thanks & Regards,
Narmatha.P

@narmatha

We would like to share with you that the investigation against logged ticket has been initiated. We will be able to share some ETA as soon as investigation is completed. We will share additional updates with you soon.

Hi Team,
When we use page.paragraphs.add(table), the page number is not getting updated in Aspose 9.8 version. the table contains many rows.

Ex: table rows 1000, in aspose document it be added as 100 pages. but page number is showing as “1” for all the 100 pages.
Is there any code changes to increase page number?

Thanks & Regards,
Narmatha.P

@narmatha

Thanks for your inquiry.

In such cases, you need to save PDF document in either MemoryStream or Physical disk and re-initialize Document instance to get updated page numbers. The reason is, document remains in memory before saving it and when it gets saved, all collections and meta data gets updated.

On the other hand, you may try calling ProcessParagraphs() method of Document Class after which you can get correct page numbers. Please take into account that this method may effect performance and program may take longer.

We would also like to suggest you to try latest version of the API as it contains more performance improvements and fixes. Please let us know in case you have further inquiry.

Hi Team,
Thanks for your response.

Please let us know once the performance issue resolved.

Thanks & Regards,
Narmatha.P

@narmatha

Sure, we will inform you as soon as we have additional updates in this regard.

Hi Team,
Getting “The given key was not present in the dictionary” error when converting Aspose.pdf document into memory stream. Do you know why? this error occurs for large size of document.

like this coming in stack trace:
Aspose.pdf.textfragment
AsposePDF.Tabe.cell
AsposePDF.Tabe.row

I am not missing anything. Even it is small size the PDF is generated.
Is This issue related to performance issue ?

Thanks & Regards,
Narmatha.P

@narmatha

The issue is not related to performance. However, could you please share sample code snippet and a PDF document to replicate this in our environment. We will further investigate it and share our feedback with you.