Repository: danfickle/openhtmltopdf

Issue #119: Problem with page margins when using @page:first rule
Created: 2017-08-23T09:02:14Z
Hello,
I am trying to create a PDF file which has a kind of banner on the right side of the first page.
So i used the @page, @page:first and the @right-top rules to adjust the page margins and to insert the additional content:
@page {
  size: A4 portrait;
  margin: 10mm 5mm 15mm 20mm;
}

@page:first {
  margin-right: 55mm;
  @right-top {
    padding: 1mm;
    content: 'Some additional content\00000a@right-top\00000a(but only on the first page)';
    white-space: pre;
    vertical-align: top; text-align: left;
    background: #ffeeee;
  };
}

This works perfect for the first page, but on the follwing ones, the right margin defined in the @page:first rule is still used instead of the default value defined in the @page rule (by the way, similar effects arise when using the @page:left or @page:right rules).
For clarification please have a look at Template.html.txt and Template.pdf
Thanks,
Bigdatha

Duplicate issue #176: The page center is not calculated correctly when running with multiple page sizes
Created: 2018-02-14T11:39:36Z
Hello my html is like this.

<html>
<head>
<style>
/* The following fonts are installed on the server: */
.handwriting {
  font-family: 'handwriting', serif;
}
.arabic {
  font-family: 'arabic', serif;
}
.deja {
  /* Contains glyphs for many languages. */
  font-family: 'deja-sans', sans-serif;
}
/*
Also you can use the PDF built-in fonts: 
 - sans-serif
 - serif
 - monospace
*/
@page {
            size: A4 portrait;
            @bottom-center {
                font-family: sans-serif;
                font-size: 1em;
                content: counter(page) ".Page";
            }
        }

        @page victim_page {
            size: A4 landscape;
            margin: 5%;
            @bottom-center {
                font-family: sans-serif;
                font-size: 1em;
                content: counter(page) ".Page";
            }
        }

        #victim_list {
            page: victim_page;
            width: 100%;
        }
</style>
</head>
<body>

<p>Page1</p>

<div id="victim_list">
    <p style="text-align: center; width: 100%"><strong>Page2</strong></p>

    <table style="height: 30px; width: 390px; font-size: xx-small;">
        <tbody>
        <tr>
            <td style="width: 150px;"><strong>city</strong></td>
            <td style="width: 240px;">%city_name%</td>
        </tr>
        <tr>
            <td style="width: 150px;"><strong>district:</strong> </td>
            <td style="width: 240px;">%district_name%</td>
        </tr>
        <tr>
            <td style="width: 150px;"><strong>neighbourhood:</strong></td>
            <td style="width: 240px;">%neighbourhood_name%</td>
        </tr>
        </tbody>
    </table>

   

</div>

</body>
</html>

On the second page the page center is not calculated correctly.

Closing comment (2018-04-07T04:35:29Z): Hi @cgonul
Sorry I missed this.
I think this is related to #119. Essentially the body width is determined by the first page’s width. Perhaps the best solution would be to have the body width set by the widest page and use “shadow” floats on other pages, but I’m not sure how much work this would be or other consequences.