Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #26280

    The attached documents illustrate how to use htmlWidth and pageFormat attributes of


    I am evaluating PD4ML. We need to print a document with two different margins on either side of the sheet. That is, on the first page we have a broader margin on the left side and on the next side we have a shorter margin on the left side. Can we do this in PD4ML? If so, how?
    Alex Philip


    Unfortunately currently there is no easy way to do that.

    The horizontal margins (insets) impact HTML-to-PDF scale factor:
    scale = (pageFormat.width – insets.left – insets.right) / htmlWidth
    so a lot of flexibility in page-specific margins definitions could cause undesired drawbacks.

    However a swap of insets.left and insets.right depending on odd or even page seems to be doable and harmless. And I guess the limited feature would be sufficient for your case.

    We are ready to add it to our API. The implementation priority would depend on the PD4ML license type you own / are going to order. Please contact PD4ML support by email.


    Thanks for the reply. We are planning to go in for PD4ML Pro license.

    I have another query. I have a report in which we go in for landscape.

    We develop the report in html and then using PD4ML try to convert to pdf. But the font and everything appears to be big when we go and change the page oreintation to suit landscape. The code for the same is given below.

    PD4ML pdf = new PD4ML();
    pdf.setPageSize(new Dimension(842,595));

    How can we sort it out?
    Thanks in advance.


    As I wrote before the scale factor is computed this way:
    scale = (pageFormat.width – insets.left – insets.right) / htmlWidth

    In your case a switch from portrait to landscape means change of pageFormat.width from 595 to 842. You need to correspondingly/proportionally increase htmlWidth parameter.

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

The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.