So I have been searching for how to print a pretty basic razor html page and really haven't found an answer. The page in question just has a regular html table and some viewbag data. Printing in landscape mode used to be really simple so I'm having a hard time believing this is a functionality that just disappeared. I am using IE 11 and CSS3, an MVC5 project with razor. It does not need to be functional in any other browser either. here's all the things I have tried
example 1: does not change print landscape, the double @'s are to escape the razor @ usage
@@media print
{@@page {size: landscape}}
example 2: also does not change print landscape
@media print{@page {size: landscape}}
example 3: for this one I tried a bunch of different variations with the margins and the width and height settings. I also tried changing body to @page, @@page, and to a div IDs or class names. It sort of works, but it never takes up the full page length and is always shifted in some direction or another.
<style type="text/css" media="print">
body{
margin: 150px 10px 20px 50px;
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
width: 10px;
}
</style>
I feel like there has to be a way to do this, it used to be pretty simple by using this example.
example 4: however this one also does not change print orientation and instead gives the error of "CSS3.0: size is not a known CSS property name."
<style type="text/css" media="print">
@page {
size: landscape;
}
</style>
Any help would be really appreciated, I know there are several threads on this topic, however none of the answers did it for me. Here are the threads I checked out, I checked out more, but these seemed to have the most varied answers so I included them.