feat: tighter PDF margins + shorter QR caption
wkhtmltopdf default top margin is ~25mm — leaves a half-page of empty space above the provenance header on every PDF. Set explicit 12mm top/bottom and 15mm left/right via pandoc -V margin-* options. Shorten QR caption from 'Scan to visit the living source' (six words, wrapped onto four lines in the 160px cell) to 'Scan for living source' (four words). Widen the QR cell from 160px to 200px so the caption sits on one or two lines without crowding the QR.
This commit is contained in:
parent
63a5a939c0
commit
d7fa7d1b93
2 changed files with 13 additions and 4 deletions
|
|
@ -216,9 +216,18 @@ def convert(source, from_format="markdown", to_format="html5", title=None, stand
|
||||||
else:
|
else:
|
||||||
cmd.extend(["--metadata", "title={}".format(title)])
|
cmd.extend(["--metadata", "title={}".format(title)])
|
||||||
|
|
||||||
# PDF needs explicit engine since no pdflatex.
|
# PDF needs explicit engine since no pdflatex. Tighten margins —
|
||||||
|
# wkhtmltopdf defaults to ~25mm top which leaves a half-page of empty
|
||||||
|
# space above content. 12mm/15mm is enough to look printed without
|
||||||
|
# wasting paper.
|
||||||
if to_format == "pdf":
|
if to_format == "pdf":
|
||||||
cmd.extend(["--pdf-engine=wkhtmltopdf"])
|
cmd.extend([
|
||||||
|
"--pdf-engine=wkhtmltopdf",
|
||||||
|
"-V", "margin-top=12mm",
|
||||||
|
"-V", "margin-bottom=12mm",
|
||||||
|
"-V", "margin-left=15mm",
|
||||||
|
"-V", "margin-right=15mm",
|
||||||
|
])
|
||||||
|
|
||||||
if is_binary:
|
if is_binary:
|
||||||
# Binary formats need file output.
|
# Binary formats need file output.
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,8 @@ def header_md(canonical_uri, snapshot_iso=None, version="dev",
|
||||||
'<td style="border: 0; vertical-align: top; padding: 0 24px 0 0;">\n\n'
|
'<td style="border: 0; vertical-align: top; padding: 0 24px 0 0;">\n\n'
|
||||||
'{text}\n\n'
|
'{text}\n\n'
|
||||||
'</td>\n'
|
'</td>\n'
|
||||||
'<td style="border: 0; vertical-align: top; width: 160px; text-align: right;">\n\n'
|
'<td style="border: 0; vertical-align: top; width: 200px; text-align: right;">\n\n'
|
||||||
'\n\n'
|
'\n\n'
|
||||||
'</td>\n'
|
'</td>\n'
|
||||||
'</tr>\n'
|
'</tr>\n'
|
||||||
'</table>\n'
|
'</table>\n'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue