PDFReactor .NET - @page is not exist is current context

364 Views Asked by At

I am try to change the orientation of my pdf to landscape via PDFReactor. I'am using MVC .Net .

From the documentation, supposed we can change the orientation by using this line

@page{
size: letter landscape;}

This is my code on the cshtml

<html>
<head>
<style>
 @page { size: letter landscape;}
.t_padding { padding-bottom: 200px;}
</style>
</head>

<body>
<div style="width:595px; height:842px; padding:15px; text-align:center; border: 10px solid #787878; background-color:antiquewhite; margin:0 auto">

    <div class="row t_padding">
        <div class="col-md-12 t_padding"><span class="colorred" style="font-size:45px; font-weight:800; font-family:Bahnschrift; margin-top:50px">Certificate of Completion</span></div>
    </div>
    <br /><br />
    <span style="font-size:25px"><i>This is to certify that</i></span>
</div>
</body>
</html>

However I got an error on the css (The name 'page' does not exist in the current context)

And when I run it, obviously it doesn't work.

Any suggestion? Did I miss anything

1

There are 1 best solutions below

0
On BEST ANSWER

Sorry guys.

I found the answer in this post : "The name 'media' does not exist in the current context"

Basically it's due to the '@' symbol is actually a reserved character in Razor and we could escape it by using '@@'