PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) HTML/CSS rendering issues Why 97 PPI and not 96 PPI in this lib?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • mhs
    #27219

    The current results looks like the follwoing values are used for pixel / dot / inch conversion:
    72 DPI / 97 PPI

    should not the follwowing values usesd?:
    72 DPI / 96 PPI

    It looks like a internal rounding bug. INT to float or something like that.

    Converted px values looks like 97ppi is used…

    STYLE:
    <br /> <style type="text/css"><br /> body {<br /> font-family: Arial;<br /> font-size: 9pt;<br /> }<br /> <br /> .page {<br /> margin: 0 auto;<br /> width: 21cm;<br /> }<br /> <br /> .page-body {<br /> margin-left: 10mm;<br /> margin-right: 10mm;<br /> }<br /> <br /> .square {<br /> background-color: black;<br /> color: white;<br /> margin-bottom: 1mm;<br /> text-align: center;<br /> padding: .5em;<br /> }<br /> </style><br />

    HTML:
    <br /> <div class="page"><br /> <div class="page-body"><br /> <h1>Hello World</h1><br /> <br /> <div class="square" style="height:1in;width:1in;">width 1in</div><br /> <div class="square" style="width:2.54cm;">width 2.54cm</div><br /> <div class="square" style="width:72pt;">width 72pt</div><br /> <div class="square" style="width:96px;">width 96px</div><br /> <hr><br /> <br /> <div class="square" style="width:2in;">width 2in</div><br /> <div class="square" style="width:5.08cm;">width 5.08cm</div><br /> <div class="square" style="width:144pt;">width 144pt</div><br /> <div class="square" style="width:192px;">width 192px</div><br /> <hr><br /> <br /> <div class="square" style="width:4in;">width 4in</div><br /> <div class="square" style="width:10.16cm;">width 10.16cm</div><br /> <div class="square" style="width:288pt;">width 288pt</div><br /> <div class="square" style="width:384px;">width 384px</div><br /> </div><br /> </div>

    #30216

    By default PD4ML convert all physical units to screen pixels using 72ppi, after that the entire document content is scaled depending on htmlWidth value (width of virtual HTML renderer frame) and on the chosen target paper format width: htmlWidth is mapped to pageWidth, so the actual scale factor varies and is not bound to 72 or 96 ppi.

    If you prefer to work with physical units, trigger
    pd4ml.protectPhysicalUnitDimensions() – in the case the elements should appear on paper in the originally desired size.

    #30217

    Please look at the code:

    <div class="square" style="height:1in;width:1in;">width 1in</div><br /> <div class="square" style="width:2.54cm;">width 2.54cm</div><br /> <div class="square" style="width:72pt;">width 72pt</div><br /> <div class="square" style="width:96px;">width 96px</div><br />

    All bars should have the same width but the 96px bar is smaller… a 97px matches so i think the internal factor is wrong or rounded to much or something like that.
    A global scale should not do something on the relative size of the elements to each other 1inch = 2.54 cm; 1inch = 72 pt; 1inch = 96px <- and it looks like this is actually 1inch = 97px The match of real paper inch don't matter here.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.