High memory usage when applying textstamp on PDF

Hi

There appears to be some memory management issues within the PDF product when applying textstamp on PDFs. I have tested the API will 14.5 MB document which has around 3600 pages.

Here is the code I am using:

var asposeLicense = new AsposePdf.License();
asposeLicense.SetLicense(“Aspose.Total.lic”);
asposeLicense.Embedded = true;

            // Create text stamp
            AsposePdf.TextStamp textStamp = new AsposePdf.TextStamp("Sample Stamp");

            // Set whether stamp is background
            textStamp.Background = false;

            // Set origin
            textStamp.XIndent = 100;
            textStamp.YIndent = 100;

            // Rotate stamp
            textStamp.Rotate = AsposePdf.Rotation.on90;

            // Set text properties
            textStamp.TextState.Font = AsposePdf.Text.FontRepository.FindFont("Arial");
            textStamp.TextState.FontSize = 40.0F;
            textStamp.TextState.FontStyle = AsposePdf.Text.FontStyles.Bold;
            textStamp.TextState.FontStyle = AsposePdf.Text.FontStyles.Italic;
            textStamp.TextState.ForegroundColor = AsposePdf.Color.FromRgb(System.Drawing.Color.Red);

            long size0 = GC.GetTotalMemory(false) / 1048576;
            Console.WriteLine("Memory Size Before Creating Aspose.PDF Document Object: {0}MB", size0);

            // Open document
            using (AsposePdf.Document pdfDocument = new AsposePdf.Document(a_sFile))
            {
                Console.WriteLine("Aspose Object in GC Generation: {0}", GC.GetGeneration(pdfDocument));

                long size1 = GC.GetTotalMemory(false) / 1048576;
                Console.WriteLine("Memory Size After Creating Aspose.PDF Document Object: {0}MB", size1);
                
                // Add stamp to particular page
                pdfDocument.Pages[2].AddStamp(textStamp);

                // Save output document
                pdfDocument.Save(@"C:\Temp\Out_" + a_sFile.Substring(a_sFile.LastIndexOf("\\") + 1));
                
                long size2 = GC.GetTotalMemory(false) / 1048576;
                Console.WriteLine("Memory Size After Saving the Changes to Disk: {0}MB", size2);
                
                // Commented, Using statement is handling dispose
                //pdfDocument.Dispose();

                Console.WriteLine("Aspose Object in GC Generation: {0}", GC.GetGeneration(pdfDocument));
            }

Thanks

@gaurav_saini

Thank you for contacting support.

Would you please share your source document via Google Drive, Dropbox etc. while mentioning the amount of memory consumed for that particular document in your environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.8.

I am using Aspose.PDF .net 19.8, In order to stamp 14.5MB document application is using 124 - 146 MB memory and this application will be utilized by large number of users for stamping.
image.png (5.0 KB)

Please download the document from following link:
https://drive.google.com/file/d/1pHWggiI2vAnqzttdI425mHoel4w-sY_-/view?usp=sharing
http://www.datalogics.com/pdf/doc/Version6.1/CoreAPIReference.pdf

@gaurav_saini

Thank you for sharing requested data.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46799 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi Farhan,

Thanks for the update, Could please share the priority of the issue? Will it be fixed in next release?

Thanks,
Gaurav

@gaurav_saini

Please note that the issue has been logged under free support model and will be investigated on first come first serve basis. Therefore, it may take some months to resolve. As soon as we have some definite updates regarding ticket resolution, we will let you know.

Furthermore, we also offer paid support model where issues are resolved on urgent basis and have priority over the issues logged under free support model. You may check our Paid Support options for your reference.

Dear Support, we are considering buying the Paid Support option, if we did, what do you see as the likelihood of this issue even being one that can be addressed, both technically, and in a reasonable timeline? Thanks.

@jlenesch

Paid support tickets have higher priority thus scheduled and resolved on priority basis. Such tickets are resolved sooner as compared to free support tickets. So you may consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

Farhan, I have been in contact with sales regarding Paid Support, they indicated that I should post to the ticket the questions as to if this issue is even fixable, and if so on what schedule (assuming we bought Paid Support) and sales indicated the support team would let me know so I can then decide if buying Paid Support will actually move this forward. So I’m really just interested in, based on what you know form the ticket, do you think this is even something that can be addressed, or is the technology such that this is just the way it must work? Thanks.

@jlenesch

Thank you for the details.

We have recorded your request for ETA with Paid Support subscription and will let you know once it will be available after initial investigations.

Farhan,

Just checking if there is any update? Thanks.

@jlenesch

Thank you for getting back to us.

We are afraid any update is not available yet. We have recorded your concerns and will let you know as soon as any feedback will be available.

Just checking if there is any update? Thanks.

@jlenesch

Thank you for following up.

It is scheduled for investigations in this week, we will let you know once any information will be available.

Farhan,

What did the investigation turn up? If I can’t get this solved I might need to look at alternative products - which I would rather not do. Thanks.

@jlenesch

We are afraid any feedback is not available yet. Please spare us little more time and we will get back to you once some information will be available for this ticket.