HTMLとCSSからPDFを生成するPDFreactorを評価しています。
しかし、問題が発生しました。ドキュメント セクションの 1 ページ目と 2 ページ目と 3 ページ目でページの背景画像を別々に設定する必要があります。可能と思われる唯一の方法 ( PDFreactor マニュアルを参照) は、ドキュメント セクションに関連する番号ではなく、固定のドキュメント ページ番号を明示的に指定することです。
Paged Media Module の CSS 生成コンテンツ は、この表記法を使用することを提案しています。
CSS:
@page:-nth(1 of PPSid1117) {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
@page:-nth(2 of PPSid1117) {
background: url("http://example.com/bg2-section1.png") no-repeat center center;
}
@page:-nth(3 of PPSid1117) {
background: url("http://example.com/bg3-section1.png") no-repeat center center;
}
#PPSid1117 {
page: PPSid1117;
}
HTML:
<div id="PPSid1117">Up comes 10 pages of lorem ipsum, the first three pages having different backgrounds... etc etc ...end of section.</div>
しかし、まったく機能しません。解析エラーがスローされます。
Parse error in resource "main_css.php?doc=50"
Encountered '1' at position 11 in rule '@page:-nth(1 of PPSid1117)
ところで、-ro-nth はエラーをスローしませんが、それでも機能しません。
@page:-ro-nth(1 of PPSid1117) {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
このコードは、セクションのすべての左側のページにそれを配置します (したがって、名前付きページセレクターが基本レベルで機能することを証明します) が、私が望むものではありません。
@page PPSid1117:left {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
これは機能しますが、ページ番号をハードコーディングする必要があることを意味します。やりたいことじゃない…
@page:-ro-nth(4) {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
これにより、セクションの 1 ページではなく、ドキュメントの 1 ページに配置されます。
@page PPSid1117:-ro-nth(1) {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
これは、Prince XML で私が望むことを行います。
#PPSid1117 {
page: PPSid1117;
prince-page-group: start;
}
@page PPSid1117:nth(1) {
background: url("http://example.com/bg1-section1.png") no-repeat center center;
}
誰にも役立つ提案はありますか?ありがとう。