1

我正在尝试通过 PDFReactor 将我的 pdf 的方向更改为横向。我正在使用 MVC .Net 。

从文档中,假设我们可以使用这条线来改变方向

@page{
size: letter landscape;}

这是我在 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>

但是我在 css 上遇到错误(当前上下文中不存在名称“页面”)

当我运行它时,显然它不起作用。

有什么建议吗?我错过了什么吗

4

1 回答 1

1

对不起大家。

我在这篇文章中找到了答案: “当前上下文中不存在名称‘媒体’”

基本上这是因为 '@' 符号实际上是 Razor 中的保留字符,我们可以使用 '@@' 对其进行转义

于 2020-02-13T16:14:36.947 回答