Rank: Newbie Groups: Member
Joined: 9/7/2011 Posts: 3
|
Using EO.Pdf.PdfDocument, I am rendering 14 website pages, on average, with HtmlToPdf.ConvertUrl. This process works fine. However, the size of the resultant PDF is 40MB, and this size is excessive for our storage.
I have tried to change the size of the PDF pages dropping them to half the 8x11 size. However, that did not lessen the pdf physical size on disk. Are there other processes or techniques that can be recommended to lighten the PDF size, even if the quality is dropped. For example, is there information that I should be stripping including metadata, color, or hidden information?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Try to set HtmlToPdf.Options.SaveImageAsJpeg to true. Most of the time when the result PDF file is too large, it's because of images (remember all images are EMBEDED in the PDF file, that’s why you can take the PDF file anywhere and open it). Once you set SaveImageAsJpeg to true, the converter will automatically compress the images as jpegs. That often can reduce the file size significantly. You may also want to adjust HtmlToPdfOptions.JpegQualityLevel. Valid values are from 1 to 100. The lower the value, the lower the quality and the smaller the file size.
If you have the same image that appears in more than one of your HTML files, then it may help if you combine the HTML file first and then run a single conversion. The reason is, if you have the same image appearing multiple times in the same conversion, they will only be saved once in the PDF file. However such optimization does not occur across multiple conversions even though the result of multiple conversions is merged into a single PDF file. Thus combining the HTML files first MAY help. It MAY not help because even the same image can have different rendering result --- for example, a transparent image with different background would still need to be saved multiple times during difference occurrence.
Hope this helps. Please let us know whether it resolves the issue.
Thanks
|
Rank: Newbie Groups: Member
Joined: 9/7/2011 Posts: 3
|
Worked wonderfully. The size dropped from 40MB to 2.5MB. Thanks.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Wow! That might be a record. : )
|