An “optimum” criteria differs depending on a use case. If you have an HTML document with a hardcoded table width=1000, by any htmlWidth less than 1000 the resulting document layout will be cut right side.
Let’s call the desired optimum is when 1pt defined in HTML corresponds to 1pt in PDF and in printed output. It can be useful if you need a correct font size (given in pt) conversion.
pageFormat is measured in physical units (pt)
pageInsets are also in pt
htmlWidth is in screen pixels
px/pt = 1.35
A4 width is 595pt