Hello,
We are experiencing a critical performance issue with the Doconut library used in our ASP.NET Core .Net 9, application to render PDF files. The problem arises when generating images for individual PDF pages through the /DocImage.axd
endpoint.
We have observed the following:
- Each request to render a page (e.g.,
page=...&zoom=100
) takes an excessive amount of CPU resources.
- The requests have high execution times, sometimes exceeding 90 seconds.
- Multiple requests to render consecutive pages cause a significant load on the server.
Could you please advise on the following:
- Are there recommended settings or optimizations for better performance when rendering PDF pages?
- Are there any known issues or limitations regarding high-resolution rendering (zoom=100)?
We appreciate your prompt guidance or solution to this issue, as it is severely affecting our application’s performance.
image.png (59.3 KB)
@Jorge_Garces,
To optimize PDF rendering and minimize memory usage, you can configure the following properties in the PdfConfig
class:
- ResizeImages: Enable this property to reduce the resolution of images in the PDF.
- ResizeResolution: Set the target resolution for resized images to achieve the desired balance between quality and performance.
- CompressImages: Activate this property to apply image compression within the PDF.
- CompressQuality: Adjust the compression quality to strike a balance between memory usage and image clarity.
Additionally, consider lowering the value of the ImageResolution property. While the default is set to 200, experimenting with lower values may improve rendering speed while maintaining acceptable image quality.
Regarding the question: “Are there any known issues or limitations regarding high-resolution rendering (zoom=100)?”
By default, the zoom level is set to 100%, which provides high-resolution rendering. However, higher zoom levels can lead to increased memory usage and slower performance, particularly for large or complex documents.
The Viewer class offers two properties to help manage this:
- Zoom: This property allows you to set a default zoom level for rendering.
- MaxZoom: With this property, you can limit the maximum zoom level for document pages, preventing excessive memory usage when rendering at very high resolutions.
For optimal performance, consider configuring these properties to balance rendering quality and system resource usage.
Hello,
I have followed all the recommendations, but the issue persists. What we have identified is that when the .pdf files have more than 100 pages, that’s when the resources appear to get stuck. With that in mind, is there anything else we can do in this scenario?
@Jorge_Garces,
Thank you for reaching out regarding performance issues when processing large files. One potential solution to improve performance is to increase the resources of the server or environment where Doconut is running. Upgrading the processor, adding more RAM, or optimizing storage can often lead to significant performance improvements, especially for resource-intensive tasks.
Additionally, I’d like to highlight that Doconut is compatible with a webfarm architecture. This setup distributes the processing workload across multiple servers or instances, providing improved performance and scalability in high-demand scenarios.
In our provided sample projects package (available in the ZIP file), you will find examples demonstrating how to configure and use Doconut in a webfarm environment. These examples illustrate how to distribute file processing tasks effectively across multiple servers or instances to optimize resource usage and processing speed.