The HTML width is given by the BrowserWidth
property of the HiQPdf.HtmlToPdf
class which is 1200 pixels by default. At a default DPI of 96 the HTML width is 12.5 inch which is larger than the default A4 portrait page width of 8.27 inch
and the HTML is scaled down to fit the PDF page which means that the text and images might appear smaller than they are in HTML.
There are two options to avoid scaling down the HTML rendered in PDF:
- To set to false the FitPageWidth property of the HiQPdf.PdfDocumentControl class
An object of the HiQPdf.PdfDocumentControl
type is exposed by the Document property of the
class. In this case the PDF page size width will be automatically resized to display the whole HTML. You can disable this behavior if you set the
property of the HiQPdf.PdfDocumentControl
class to false.
- To set the BrowserWidth property of the HiQPdf.HtmlToPdf class to a smaller value
For a A4 portrait PDF page without margins the BrowserWidth
property should be set to 793 pixels which is the result of multiplying the width of the PDF page 8.27 inch with 96 DPI. If you have set the left or the right margin for the PDF pages you
should take this in consideration when calculating the browser width.