Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Mar 14, 2025 11:08 am

Hey everyone,

We’ve come across another issue with the library, and we’re hoping you might have some insights!

While converting PDFs to Word, we noticed a major difference in memory usage between two NuGet packages: Spire.PDF and Spire.PDFfor.NETStandard.

Here’s what we found:

During development, we used Spire.PDF on a Windows 11 machine with 64GB RAM, and everything ran smoothly.

Since our product runs in a Docker container, we switched to Spire.PDFfor.NETStandard, as the standard version of Spire.PDF relies on native Windows functionality and doesn’t work inside Docker.

Initially, this worked fine on both Windows and macOS (16GB+ RAM) and inside our test Docker container.

However, once deployed in Azure Container Apps (2 vCPU, 4GB RAM), one of our clients tried exporting a 7-page PDF (with 10-15 images and some tables), and it crashed the server in seconds.

We investigated and found that Spire.PDFfor.NETStandard was consuming up to 6GB RAM for that document. Doubling the pages resulted in 12GB RAM usage consistently.

For comparison, switching back to Spire.PDF locally showed a much lower memory footprint—barely exceeding 2GB for the same PDF.

Testing with another PDF confirmed a similar trend: Spire.PDFfor.NETStandard used 2GB RAM, while Spire.PDF used only 200MB.
Since memory usage appears to scale linearly with the number of complex pages, simply increasing RAM isn’t a sustainable solution—some reports could be tens or even hundreds of pages.

We can’t share the exact PDF that caused the issue, but we’d love to hear if anyone has encountered a similar problem or has ideas on how to optimize this!

Best regards,
Ognjen

ognjen.stefanovic
 
Posts: 6
Joined: Tue Feb 18, 2025 1:08 pm

Mon Mar 17, 2025 9:23 am

Dear Ognjen,

Thanks for your feedback.
Spire.PDF and Spire.PDFfor.NETStandard have different dependencies when processing images. The former uses System Drawing.Common, while the latter uses Skiasharp, so there is indeed a difference in memory consumption when processing documents containing images. We offer two ways to convert PDF to Word. What specific code are you using? To facilitate our more accurate investigation, please provide the following information:
1. Your test code.
2. Your project framework, such as NET6.
3. Do you directly publish to Azure Web App or test on virtual machines created on Azure?
4. If possible, please provide the PDF file you used for testing. Please rest assured that all provided documents are for testing and troubleshooting purposes only and will be strictly kept confidential. You can directly send the PDF to my email ([email protected]).

Thanks in advance for your assistance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF

cron