Hi Team,
I have the below code to convert PDF to PNG. My PDF file is around 20MB with one page only. While converting from PDF to png, it consumes high memory around more than 6 GB. The server gets hung. Please find attached consumption image from diagnostic tool.
High consumption line -
imageDevice.Process(pdfDocument.Pages[pageCount], imageStream);
Below code example -
private List ConvertPdftoImage(ImageDevice imageDevice, Stream stream)
{
var imageStreams = new List();
using (Document pdfDocument = new Document(stream, true))
{
stream.Position = 0;
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
using (MemoryStream imageStream = new MemoryStream())
{
imageDevice.Process(pdfDocument.Pages[pageCount], imageStream);
imageStream.Position = 0;
imageStreams.Add(imageStream);
imageStream.Close();
}
}
}
return imageStreams;
}
Memory consumption.png (51.0 KB)
@sopya.88
Would you please make sure that you are using 24.5 version of the API and if issue still persists, please share your sample PDF by uploading it to Google Drive. We will test the scenario in our environment and address it accordingly.
with the latest version 24.5.0, its crashing while processing on same line and also its taking same time and memory for processing, after 5 min its get failed throw exception. Please see below error,
Error - Aspose.PDF: The type initializer for ‘Aspose.Pdf.XmpField’ threw an exception. Aspose.PDF: The type initializer for ‘Aspose.Pdf.XmpValue’ threw an exception. Aspose.PDF: Could not load file or assembly ‘System.Text.Encoding.CodePages, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. The system cannot find the file specified.
Note - I have pdf file with only 1 page and size of PDF is more than 15 MB. Please try at your side with 15+MB file with single pdf page.
I have license of 22.4.0 version. If it works with 24.5.1 then I want to upgrade to higher version. will renew the liscense.
@sopya.88
We tested using one of our sample PDFs and could not replicate this exception as it seems related to a specific PDF document. We again request you please share your sample file with us so that we can further proceed with it accordingly.
Any memory consumption issue you faced at your end while processing a single page pdf with 20 MB? could you please share the screenshot if possible? mean while I will arrange the test file for you.
@sopya.88
We are not sure what kind of screenshot you requested. Furthermore, memory consumption related issues were reported before as well but they are always document specific. Even a less sized document can cause such issue due to its complex structure. Which is why we requested for a sample document. Even if we are able to replicate the issue with some sample file of our own, we would still request a file from your side because it does not guarantee that the issue will be resolved for your PDF document as well. We cannot consider two identical PDF files to be similar as they can always differ in terms of their structure and schema.
PFA file which is causing memory consumption issue. Please test and share the details about processing time and memory consumption details.
https://drive.google.com/file/d/1fuE7mwlt7HStYmUbMRPWsBvUqUSppXYK/view?usp=drive_link
@sopya.88
We are checking it and will back to you shortly.
@sopya.88
We tested using 24.5 version and noticed that the memory consumption went up-to 4G during conversion. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-57289
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hi Team,
Any update on this ticket (PDFNET-57289)?
We already have a paid license but from another account. We have the order ID and user ID of the paid account.
We want to renew it as it will expire by the end of this month, but due to this memory issue, We are in doubt. Could you please help us to get it resolved as the priority?
And for further discussion, Is there any other private forum available where we can exchange this communication? We don’t want to disclose sensitive data going forward.
Thank you.
@sopya.88
The ticket has recently been logged in our issue tracking system and as per free support policies, it will be prioritized on a first come first serve basis. We do understand the issue urgency for you and for that, we have updated its information by recording your concerns. We will surely inform you once we have some information about its fix ETA.
Furthermore, if you want to get it resolved on urgent basis using your paid support account, you can create a ticket in the respective support forum with the reference to the ticket ID share here. Your issue will be escalated accordingly.
In order to get detailed information about your subscription, you can please create a post in our Purchase Forum where you can discuss further details with our Sales Team. They will guide and assist you accordingly.