XHtmlOptions ImageQuality Property. The quality of compression acceptable for continuous tone images such as JPEGs. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Value Read Only Description
[C#]int

[Visual Basic]
Integer
101 No The quality of compression acceptable for continuous tone images such as JPEGs.

 

   

Notes
 

This property determines the image quality acceptable when rendering HTML.

ABCpdf uses a high quality lossless compression method for image compression when rendering HTML.

Using this setting you can indicate the quality of compression which is acceptable for continuous tone images such as JPEGs.

This can result in a considerable reduction in file size with little or no loss in output quality.

Note that the MSHTML engine contains optimizations to allow data to be passed directly from the web through to the PDF without recompression. However it can only do this if you do not indicate that you need this data recompressed. As such you may find it more effective in terms of output size and ouput quality, to leave the default setting in place.

Qualities should range between 0 and 100 (75 is a reasonable value). Values higher than 100 will result in lossless compression being used in all situations.

 

   

Example
 

The following example shows the effect that this parameter has on PDF rendering.

[C#]
Doc theDoc = new Doc();
string theURL = "http://www.nasa.gov/multimedia/imagegallery/image_feature_313.html";
// Set low image quality for HTML rendering
theDoc.HtmlOptions.ImageQuality = 5;
theDoc.AddImageUrl(theURL);
// Save the document
theDoc.Save(Server.MapPath("HtmlOptionsImageQuality5.pdf"));
theDoc.Clear();
// Set lossless image quality for HTML rendering
theDoc.HtmlOptions.ImageQuality = 101;
theDoc.AddImageUrl(theURL);
// Save the document
theDoc.Save(Server.MapPath("HtmlOptionsImageQuality101.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
Dim theURL As String = "http://www.nasa.gov/multimedia/imagegallery/image_feature_313.html"
' Set low image quality for HTML rendering
theDoc.HtmlOptions.ImageQuality = 5
theDoc.AddImageUrl(theURL)
' Save the document
theDoc.Save(Server.MapPath("HtmlOptionsImageQuality5.pdf"))
theDoc.Clear()
' Set lossless image quality for HTML rendering
theDoc.HtmlOptions.ImageQuality = 101
theDoc.AddImageUrl(theURL)
' Save the document
theDoc.Save(Server.MapPath("HtmlOptionsImageQuality101.pdf"))
theDoc.Clear()


HtmlOptionsImageQuality5.pdf [file size 42 KB]


HtmlOptionsImageQuality101.pdf [file size 444 KB]