PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ Optimum HTML width for A4 in pd4ml

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

    Hi All,

    could you please guide me to choose the best html width for pd4ml.

    I could find the formula,
    scale = (pageFormat.width – pageInsets.left – pageInsets.right) / htmlWidth

    Is the pageFormat.width 595 corresponds to 793 px? So if I have an inset of 10px, can I choose the html width as 773px, please help me to set this. Or is there any optimum html width for A4 ?

    Can I set

    pd4ml.setHtmlWidth(“773”);

    Thanks in advance to all.

    Regards
    SarinTs

    #29758

    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

    (pageFormat.width – pageInsets.left – pageInsets.right) / htmlWidth = 1/1.35
    htmlWidth = 1.35 * (pageFormat.width – pageInsets.left – pageInsets.right)
    for A4:
    htmlWidth = 1.35 * (595 – pageInsets.left – pageInsets.right)

    If the desired optimum is 1px defined in HTML corresponds to 1pt in PDF and in printed output.

    htmlWidth = 595 – pageInsets.left – pageInsets.right

    For landscape A4 orientation replace 595 with 842

    #29759

    thank you

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

The forum ‘General questions / FAQ’ is closed to new topics and replies.