简体   繁体   English

使用 pandoc 将 Markdown 转换为 PDF 时,如何设置页码样式?

[英]How Can I Style Page Numbers When Converting Markdown to PDF with pandoc?

I am using pandoc to convert a markdown file to a PDF with page numbers in the headings, with a command like:我正在使用pandoc将 markdown 文件转换为标题中带有页码的 PDF,命令如下:

pandoc \
--pdf-engine=wkhtmltopdf \
--pdf-engine-opt="--header-right" \
--pdf-engine-opt="[page]" \
-c _style.css \
"$markdown" -o "$pdf"

I am able to style the body of the pages with the _style.css file, but I cannot figure out how to set styles for the page numbers in the headings.我可以使用_style.css文件设置页面正文的样式,但我无法弄清楚如何为标题中的页码设置 styles。

Specifically, I want to set the font-family , font-size , and margin for the heading displaying the number for each page.具体来说,我想为显示每页数字的标题设置font-familyfont-sizemargin

I figured this out via https://wkhtmltopdf.org/usage/wkhtmltopdf.txt我通过https://wkhtmltopdf.org/usage/wkhtmltopdf.txt 解决了这个问题

I needed to use more --pdf-engine-opt flags:我需要使用更多--pdf-engine-opt标志:

pandoc \
--pdf-engine=wkhtmltopdf \
--pdf-engine-opt="--header-right" --pdf-engine-opt="[page] of [topage]" \
--pdf-engine-opt="--header-font-name" --pdf-engine-opt="Courier" \
--pdf-engine-opt="--header-font-size" --pdf-engine-opt="10" \
-c _style.css \
"$markdown" -o "$pdf"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM