问题标签 [css-paged-media]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
html - 每个打印页面上的最后一个元素的样式不同
我有一个元素列表(任意长度)。但是,当用户打印它时,我想更改每一页上最后一个元素的样式。
到目前为止,我尝试使用@page {.el:last-child...}
,但什么也没做。并且 usingel:last-child
仅将样式应用于最后一页上的最后一个孩子。
任何帮助表示赞赏。
我有以下 HTML:
css - 在多个内容属性中引用 base64 数据
有没有一种方法可以定义一次并在多个内容属性中引用它,而不是多次使用相同的 base64 数据?
我不能使用类,因为我需要能够将它与 css 分页媒体选择器一起使用:
我也不能使用 javascript,因为 CSS 不是由浏览器呈现,而是由 CSS 分页媒体处理器(Prince XML)呈现。
css - Changing CSS running element counter style after few pages
I am generating PDF document using FlyingSaucer with page numbers in running header. What I am trying to achieve is to be able to change style of counter applied to running element used for header.
Since the CSS is applied by FlyingSaucer I cannot use javascript.
Example html:
css:
This piece of css correctly applies headers to the whole document after
is placed.
I am trying to start my document with above page styling ( lower-roman ) and after specific place in my document - let's say I would like to either change content of right-header or replace @page content with different running element for the rest of the document with styling set to decimal numbers.
I know that FlyingSaucer has limited CSS3 support but I cannot find any solution ( not restricted to only FlyingSaucer) for such problem.
Content of running header can be changed without effect on previous headers as FlyingSaucer allows to reset the counter at any point of the document using css rule.
and change is visible only after that point.
So my current status is that I have pages numbered with lower-roman i-iv ( for title page, TOC etc. ) and then reset back to i and increment till the end of document. All I need to do is to change
to
or switch displayed running element to the new one.
Another solution I have tried which adds another possibility to solve this problem:
with this code I think the solution would be to enable #forcontent and disable #before at the beginning of #content. I have tried working with ~ selector but it doesn't work for changing preceding elements.
Does anybody know how this could be achieved or could point me to different solutions I could try?
html - 如何使用 PDFRreactor 构建具有复杂 html 和样式的 pdf 标题(左上角和右上角)?
我正在使用 PDFReactor 生成 pdf。<a>
使用 @top-left 和 @top-right 使用复杂的 html 标签(如tag 而不是简单的原始文本)来构造 pdf 顶部的最佳方法是什么@top-right{content: "some text"}
?
javascript - 在 Chrome 上使用 Javascript 获取打印页面宽度/高度
我想打印一个 HTML 页面并对我得到的打印布局进行更多控制,所以我首先将 @page 设置为特定大小(在我的情况下为 A4 肖像),现在我需要检查我拥有的一些动态内容是否可以适合该页面还是我必须在几个地方手动拆分它。
我遇到的主要问题是如何获取打印页面的高度/宽度尺寸。
我尝试设置一个宽度和高度为 100% 的 div 并获得它的高度,但它给了我一个错误的结果。为了便于测试,您可以使用:https ://playground.jsreport.net/w/anon/KpNomfIu (它是一个打印到 PDF 的库,基本上只使用 chrome 打印并显示 pdf)。
无论我使用 A3、A4 还是 A1,我的高度总是 600 像素,所以很明显这是错误的。
这只需要在 Chrome 上工作。(我知道这很奇怪,但我需要一个使用 CSS3 Paged Media 和所有相关内容无法实现的布局)