Tips to reduce PDF file which is generated using EVO HTML to PDF converter dll

5k views Asked by At

I am using EVO PDF dll to generate PDF from HTML, but I ma facing problem of large size of the generated PDF file. This HTML contain contains few JPEG images too, I tried compression option in evo but still file size is still High.

If the Original size of HTML is 40 KB then also EVO PDF generates PDF with size 400 KB which is quite HIGH.If we use RDLC to achieve same then RDLC will generate it in 80 or 100 KB. So what things I can do to reduce the PDF size ?

3

There are 3 answers

1
Sagar Shirke On BEST ANSWER

Finally I got success in reducing the size by doing below changes.

1.Use Vector image instead of bitmaps (which takes more size also looses quality after zoom).

2.Use CSS instead of images wherever possible.

3.Use standard fonts.

4.Use pdfConverter.ConversionDelay = 0

5.Use pdfConverter.PdfDocumentOptions.EmbedFonts = false

6.Use pdfConverter.PdfDocumentOptions.CompressCrossReference = true;

7.Use pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Best;

8.If you are using Evaluation copy the size will little more because of "Demo Evaluation Copy" watermark

If even after size is too high then go for Paid .Net PDF compressor dlls like Neeviapdf etc which will be used to compress PDFs generated by EVo (these dlls usually compresses the file to 50% without much losing quality).

0
Holger Lockertsen On

This is an old post, but it is basically the only relevant one that comes up when you google evopdf and file size, and I would like to point others with the same problem as me in the right direction.

I recently had a problem with large file size in my application that creates millions of pdfs with evopdf every month. It is therefore important that the size is as small as possible.

When analyzing the result document I noticed that 90% of the file was made up of "X Object Forms". After a lot of testing I finally discovered that using html tables in the source document makes evopdf save this huge chunk of X Object Forms, taking up 283kb of a 312kb pdf file.

When I rewrote the code to use <div> with css display: table, table-cell etc. instead of <table>, the file size instantly went from 312 to 42 kb. That is a very significant decrease and will save us a lot of diskspace in the future.

Hope this helps someone.

Edit: On further research, I believe this has to with the use of <thead> and <tfoot> . they are reused on subsequent pages when a table spans multiple pages, and I guess that they are stored as X Object forms. It sort of makes sense, but the functionality is not worth the extra kilobytes when it's not necessary. It would be nice if someone from evopdf can confirm that this is the case.

0
EvoPdf On

Another option is to set HtmlToPdfConverter.PdfDocumentOptions.ImagesScalingEnabled = true an eventually increase the JPEG compression level. This will reduce the images size in PDF. You can also check this Set Images Scaling and JPEG Compression Level in HTML to PDF Converter result working example.