Skip to content

Commit 852640b

Browse files
add page margin content (header image, page numbers) (#576)
1 parent 1d2975a commit 852640b

File tree

2 files changed

+101
-7
lines changed

2 files changed

+101
-7
lines changed

css/print.css

+77-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Spec.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,30 @@ ${await utils.readFile(path.join(__dirname, '../js/multipage.js'))}
11171117
printStyle.textContent = `@media print {\n${printCssContents}\n}`;
11181118
this.doc.head.appendChild(printStyle);
11191119
}
1120+
const currentYearStyle = this.doc.createElement('style');
1121+
currentYearStyle.textContent = `
1122+
@media print {
1123+
@page :left {
1124+
@bottom-right {
1125+
content: '© Ecma International ${this.opts.date!.getFullYear()}';
1126+
}
1127+
}
1128+
@page :right {
1129+
@bottom-left {
1130+
content: '© Ecma International ${this.opts.date!.getFullYear()}';
1131+
}
1132+
}
1133+
@page :first {
1134+
@bottom-left {
1135+
content: '';
1136+
}
1137+
@bottom-right {
1138+
content: '';
1139+
}
1140+
}
1141+
}
1142+
`;
1143+
this.doc.head.appendChild(currentYearStyle);
11201144
this.addStyle(
11211145
this.doc.head,
11221146
`https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${

0 commit comments

Comments
 (0)