Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The page center is not calculated correctly when running with multiple page sizes #176

Closed
cgonc opened this issue Feb 14, 2018 · 4 comments

Comments

@cgonc
Copy link

cgonc commented Feb 14, 2018

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.

resim

@danfickle
Copy link
Owner

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.

@danfickle
Copy link
Owner

Closing this in preference to #119

@jggprudencio
Copy link

jggprudencio commented Jul 30, 2019

Hi @danfickle and @cgonul, I have the exactly same issue here. Has it been addressed on the newest released version? If not, how can I solve this? I tried to define the body width by the widest page, but it didn't work. Thank you!

@alexvrv
Copy link

alexvrv commented May 27, 2022

Use width: 147% on the landscape page and problem solved (kind of)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants