html - 如何打印超出@page 边距的内容?

标签 html css

在我的 css 中,我周围都有@page 边距。我正在尝试在跨越所有页面的边距(如页脚)顶部打印一些内容。所以我试图找到一个代码来忽略我的@page 边距。

我正在使用 itext 打印页面上的 pdf。

如果我设置边距:-5px,它就会隐藏在边距后面(我可以看到顶部的一部分显示出来,而下半部分不见了)

@page {
    margin-top: 1cm;
    margin-left: 1cm;
    margin-right: 1cm;
    margin-bottom: 3cm;
    size: A4 landscape; 
}

div.footerPosition {
    display: block;
    position: fixed;
    bottom: 0px;
    width: 100%;
    margin-bottom: -14px;
}

我希望打印在边距上,而不是被边距隐藏

最佳答案

你可以试试这段代码

@page :left {
margin: 0.5cm;
}

@page :right {
margin: 0.8cm;
}

关于html - 如何打印超出@page 边距的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58816236/

相关文章:

html - 在保持跨浏览器兼容的同时,以一定宽度居中标题并为其添加边距的最简单方法是什么?

html - css3 媒体查询在 ie10 以下的 IE 中不起作用

css - CSS 中 * 和 *|* 有什么区别?

html - 在 rowspan td 上将元素高度设置为 100%?

html - 永久应用 bootstrap 主题

html - 如何以数学方式计算要应用于我的 CSS 的 3D 变换?

javascript - 获取新创建的 html 属性的值

html - 3 列布局 w/center a vertically centered div

javascript - Ajax 表单未在 Chrome 上提交

html - .gitignore 父文件夹中的文件