Improving IronPDF Performance: Tips
For performance, please see the general points below:
- .NET Standard applications seem to have a small performance advantage on speed and stability, but use more memory in process. https://ironpdf.com/how-to/azure/
- 64-bit is also recommended over 32-bit
- For large Html:
- Split the HTML into sections, render to PDF, and then use the merge or append methods to connect them into a single PDF at the end.
- For large PDFs:
- Byte array (using
byte [] buffer = System.IO.File.ReadAllBytes(file);
) input size limitations (2GB) can be bypassed using instructions shown here. - Split up PDFs on a page-basis. Please see the code example shown here: https://ironpdf.com/examples/split-pdf-pages-csharp/
- Optimize your images using a service such as https://tinypng.com/ to resize images to the actual size that will be used. (Photos can be millions of px in size for example).
- Embed images as DataURIs into the HTML. This will reduce network load and improve their stability. An additional step would be Base64 encoding the images first. This FAQ will help: https://ironpdf.com/how-to/datauris/
- Localize your assets - download any remote images or assets and reference them locally. Install fonts (e.g.: Google Fonts) directly to the production server.
- Cloud servers are typically not as fast as desktop computers. Increased server specs/service levels will have an impact. Faster CPU, more RAM.
- Create a template PDF once with placeholder strings like [[name]], [[address1]], [[email]] and update them using find and replace in IronPDF. This is much faster than re-rendering a massive document. See: https://ironpdf.com/examples/csharp-replace-text-in-pdf/