I have a report that I want to print using CSS such that the first page is landscape and the second page is portrait. When I do this, the first page is fine, but the second page looks like a landscape page cropped into a portrait frame. That is, when centering text, it puts the midpoint at 5.5 inches (on 8.5x11 letter paper) and the page will break at only 8.5 inches high:
I can cheat by giving the second-page div a width of 75%. This gets the text centered and everything formatted correctly, but the page content still cuts off at 8.5in. Messing with the height will do nothing, since that will just continue to wrap to a new page.
I only need this to work in Google Chrome for right now, since this is special-purpose and not public use.
Here is my test code:
<style type="text/css">
@media print {
body { margin: 0; text-align: center; }
@page {
margin: 0.1in 0.5in 0.1in 0.5in;
size: letter portrait;
}
@page :first {
margin: 0.1in 0.5in 0.1in 0.5in;
size: letter landscape;
}
#firstpage { page-break-after: always; }
#secondpage { width: 75%; }
}
</style>
</head>
<body>
<div id="firstpage">
<p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p>
</div>
<div id="secondpage">
<p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p><p>this is a test case</p>
</div>