The way PD4ML scales HTML layout to “paper” media is explained by the link:
PD4ML uses 72dpi to translate screen pixels to physical units, but after the physical dimensions are translated to screen pixels, the entire layout is translated back to physical units (scaled to fit the target media width). The scale factor depends on htmlWidth, target paper format and paper margins.
protectPhysicalUnitDimensions() protect elements, whose sizes given i.e. in mm, from being scaled at the phase.
FYI constants used by PD4ML:
A4 is 595 x 842pt
MM_PER_INCH = 25.4;
POINTS_PER_MM = 2.835;
POINTS_PER_INCH = 72;
PIXELS_PER_POINT = 1.35;
PIXELS_PER_PICA = 12 * PIXELS_PER_POINT;
Regarding a viewer: I’ve got no good tool to recommend, but we definitely have to test PD4ML output with ICE PDF to check what is wrong there.