PD4ML renders entire HTML layout based on screen pixels dimensions. If any sizes are specified in physical units, it converts pt, mm, in values to screen pixels (assuming 72dpi resolution).

After the layout is ready, it maps it to the choosen paper format. The HTML-to-PDF scale can be calculated like that: scale = (paperFormat.width – insets.left – insets.right)/htmlWidth.

You’ve got two ways to fix the sizing problem you faced with:

  • increase htmlWidth conversion parameter value until the resulting font sizes come 12pt.
  • trigger pd4ml.protectPhysicalUnitDimensions() PD4ML API method. The approach has disadvantages: scale disproportion among elements, whose sizes specified with physical units and whose sizes specified in screen pixels.