PdfDocument#Save performance

We're using Syncfusion to convert PNG to PDFs.  Some slow transactions prompted us to profile, and we were surprised at the results.  Over 75% of the time for each transaction was simply spent writing the PDF to a Stream (PdfDocument#Save).  The majority of this time was spent compressing the PDF:

Is there a way to use a different compression algorithm (like CompressFast) to speed up write time?


2 Replies

JB Joshua Busch September 27, 2021 01:34 PM UTC

I figured it out. PdfDocument has parameter Compression that can be varied.

using MemoryStream outputStream = new MemoryStream();
pdf.Compression = PdfCompressionLevel.BestSpeed;
pdf.Save(outputStream);




SV Surya Venkatesan Syncfusion Team replied to Joshua Busch September 27, 2021 01:53 PM UTC

Hi Joshua,


Thank you for your update. We are glad to know that your problem has been solved.


Essential PDF allows you to control the compression level of the document by using the PdfCompressionLevel Enum. The compression level can be set to best, normal, none etc. Please try the below compression level to optimize the content. Please refer the below documentation link,


UG: https://help.syncfusion.com/file-formats/pdf/working-with-compression#compressing-the-pdf-content


Please let us know if you need any further assistance with this.


Regards,

Surya V


Loader.
Up arrow icon