Steven L.
Steven L.

Reputation: 2155

Pandoc HTML to PDF with Styling

I have an HTML document that I would like to convert to a PDF using pandoc and wkhtmltopdf as the engine.

Based on the pandoc manual, I am running the following command:

pandoc index.html -t html -o test.pdf --css=style.css

When I do so, I get the following output:

Loading pages (1/6) Warning: Failed to load file:///var/folders/6d/rt2z_w650f1_xfkq8g7sm59m0000gn/T/style.css (ignore) Counting pages (2/6) Resolving links (4/6) Loading headers and footers (5/6) Printing pages (6/6) Done

If I list the documents in the directory in which I ran that command, I get the following:

index.html style.css

What am I missing?

Upvotes: 2

Views: 4812

Answers (2)

Adam
Adam

Reputation: 1

This is 5 years old, nevertheless (in case someone is looking this up) I'll point out a typo (in Steve's question or how he actually ran it, I don't know). He had:

pandoc index.html -t html -o test.pdf --css=style.css

-t html means "to HTML" ... this needs -f html -t pdf, as in:

pandoc index.html -f html -t pdf -o test.pdf --css=style.css

Have a terrific day!

Upvotes: -1

mb21
mb21

Reputation: 39488

There was a bug in pandoc 2.1.3 (and possibly earlier versions).

Try upgrading to the most recent release.

Upvotes: 2

Related Questions