3

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 ?

Sagar Shirke
  • 648
  • 9
  • 32
  • I'm guessing the graphics data in the PDF has been resized larger in an attempt to provide more pixels to match a target page resolution. Are there any options to tell the conversion to not do that, or to specify a target resolution that is closer to the resolution of the JPEG images? Alternatively, can you resize/respecify the JPEG images in the HTML to indicate a resolution similar to what is usually expected by print? – RenniePet Jan 11 '15 at 11:32
  • Thanks @RenniePet I will check your suggestions and will share outcome with you. – Sagar Shirke Jan 12 '15 at 04:42
  • Did you enable compression as well, such as: document.JpegCompressionLevel = 6; document.JpegCompressionEnabled = true; – Sam Plus Plus Jan 19 '15 at 21:08

3 Answers3

3

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).

Sagar Shirke
  • 648
  • 9
  • 32
  • `pdfConverter.ConversionDelay` is useful to speed up (actually:not delay) the conversion because it is set to delay by default. But it doesn't reduce the file size.`pdfConverter.PdfDocumentOptions.EmbedFonts = false` is no option for PDF/A-1b – Mike de Klerk Sep 11 '15 at 08:00
1

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.

EvoPdf
  • 523
  • 3
  • 9
1

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.