2017-05-25 234 views
1

我需要哪些庫? 我需要傳遞哪些命令行參數?如何使用pandoc將HTML轉換爲PDF?

我已經安裝wkhtml2pdf和 我試着運行:

pandoc reports/7/report.html -t pdf -o reports/7/report.pdf

它報告的錯誤:

To create a pdf with pandoc, use the latex or beamer writer and specify 
an output file with .pdf extension (pandoc -t latex -o filename.pdf). 

回答

2

pdf不是一個有效的輸出格式。 latexbeamer(用於乳膠幻燈片)。

要創建pdf,請使用-t latex-o myoutput.pdf。您可以省略-t參數,因爲-o中的.pdf默認爲膠乳。所以,你可以使用:

pandoc reports/7/report.html -t latex -o reports/7/report.pdf 

或:

pandoc reports/7/report.html -o reports/7/report.pdf