So I'm trying Pandoc for the first time. Everything seems great but when exporting via html5 (wkhtmltopdf) my pdf output is saved with huge margins on all sides.
pandoc -t html5 -s example.md -o output.pdf
output.pdf (content output highlighted in red)
What I've tried:
Am I missing something?
What I want: Write a markdown document using Typora -> Use Pandoc to apply TOC and page numbering -> Use html5 to export pdf with custom styling.
You can't. You can try opening the PDF in Word or Google Docs and saving in a format from which pandoc can convert directly.
After downloading a website as HTML with cURL or any other workflow, you can convert the HTML code to the Markdown syntax with pandoc .
Generating PDF from Markdown with Pandoc There are actually two steps involved in converting a Markdown file to a PDF file: The Markdown source file is converted to a LaTeX source file. Pandoc invokes the pdflatex or xelatex or other TeX command and converts the . tex source file to a PDF file.
These pass through vars for wkhtmltopdf
worked for me (ubuntu 18.10 pandoc 2.6) : https://pandoc.org/MANUAL.html#variables-for-wkhtmltopdf
pandoc -t html5 -V margin-top=3 -V margin-left=3 -V margin-right=3 -V margin-bottom=3 -V papersize=letter -s example.md -o output.pdf
(Oddly wkhtmltopdf
required all margins be the same.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With