简体   繁体   中英

How to print pages in mix mode portrait & landscape

I have an angular component which is used for UI rendering and printing. I am using window.print command for the same. I need initial 2 pages in landscape mode and after page break,1 page in portrait mode.

I have tried to set orientation as landscape/portrait in corresponding div and also text-rotation solution. But nothing worked. Any other way to achieve the same? Thanks in advance.

Have you tried CSS property page ? This property is used to specify a particular type of named page.

Reference: https://www.w3.org/TR/css-page-3/#propdef-page

As the CSS below, you can add the landscape-page or the portrait-page class to the element you mean to display in landscape or portrait mode.

@page orientation-portrait {
    size: portrait;
}

@page orientation-landscape {
    size: landscape;
}

.landscape-page {
    page: orientation-landscape;
}

.portrait-page {
    page: orientation-portrait;
}

Unfortunately, this property works well in Google Chrome but not Firefox and Safari...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM