This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Font Sizing

hlslaughter wrote on 2012-05-24:
We're creating a printer-friendly page specifically for creating PDFs. We're looking to get the PDF looking precisely like the printer-friendly HTML. We're pretty close after a lot of CSS tweakage.

Is there any way to control the font size within the generated PDF?
support wrote on 2012-05-25:
The font size within the PDF should be the same as in HTML provided that the HTML width is lesser or equal to the PDF page printable area width.

If the HTML width is greater than the printable area width the HTML content is scaled down to fit the printable area width which leads to smaller font sizes.

Here are some examples you may want to try out. The examples assume the A4 paper (8.3''x11.7'') format with 0.2'' horizontal margins. The printable area width is 8.3''-(2x0.2'') = 7.9 inches which is 568.8 points.

No width specified, the font size within PDF is 12pt.
<body style="margin:0">
 <div style="font-size:12pt">
  12pt font - no width specified
 </div>
</body>


The HTML width is the same as the printable area width. The font size within PDF is 12pt.
<body style="margin:0">
 <div style="font-size:12pt; width:568.8pt">
  12pt font - HTML width == printable area width
 </div>
</body>


The HTML width is 2x the printable area width. The font size is scaled down by a half.
<body style="margin:0">
<div style="font-size:12pt; width:1137pt">
  12pt font - scaled down to 6 pt font
</div>
</body>


Hope this helps.
hlslaughter wrote on 2012-05-25:
Thanks

Adding an explicit font size fixed this. I guess some styles were different in our "print version" than on the normal page.