I am facing an issue with getting my print preview to display correctly using the @page directive in CSS. Despite setting precise page margins, the content appears squished on the print preview. You can test this using the following example:
When viewing the print preview (I'm testing in chrome), you will notice that the cards are not centered properly. I have set the card dimensions to 2.5in by 3.5in and the page size to 8.5in by 11in, which should result in 1in left and right margins, along with 0.5in top and bottom margins. However, adjusting these margins accordingly still results in a squished appearance:
https://i.sstatic.net/jqWDp.png
Below is my @page CSS:
@media print {
html, body, .printable, .results-pane, .embed-view {
width: 8.5in !important;
height: 11in !important;
}
@page {
size: 8.5in 11in;
margin-top: 0.25in;
margin-left: 0.5in;
margin-right: 0.5in;
margin-bottom: 0.25in;
}
}
Even manual adjustment of the margins does not resolve the squishing issue. The problem persists when attempting to set the margins manually, as shown in the following images:
https://i.sstatic.net/2BYLK.png
https://i.sstatic.net/oKdbb.png
I am seeking a solution to prevent the browser from compressing the content or using @print query to correct this behavior. I have tried setting margins on the body itself, but encountered difficulties with maintaining consistent top/bottom margins across multiple printed pages.