Reputation: 147
I am trying to print the receipt page below. It looks like as below in the browser. The content in the middle(with white background) has fixed width and is centered. I am using angular 7 and bootstrap 4
When i try to print it from my code using window.print() , the width of the content doesn't show correctly. The content which is in the white background takes full width of the page when in print mode. Below is how it shows in the print preview in chrome. I want the print preview to be similar as it was in the browser.
Below are the scss i am using
For the grey background
.background {
height:100%;
width: 100%;
background-color: #E9E8EA; //Grey
margin: 0px;
padding: 0px;
}
For the receipt content in the middle
.content {
height: 85.33%;
width: 35.95%;
border-radius: 5px;
background-color: #FFFFFF; //white
padding-top: 1.47%;
padding-bottom: 2.21%;
}
I would really appreciate if someone gives me idea on this.
Upvotes: 1
Views: 3967
Reputation: 364
You need to use @page
or @media print
in your css.
https://www.sitepoint.com/css-printer-friendly-pages/
Upvotes: 1