How to use "wkhtmltopdf"?
Asked Answered
C

2

6

Wkhtmltopdf is a command line tool to convert html files to pdf. I downloaded the package and ran the command on cmd line, but it didn't work. It is supposed to simply enter the path of file you want to convert then the path of the destination file to be created. I'm not so good with the cmd prompt, but here is what I did:

cd C:\Program Files\wkhtmltopdf

wkhtmltopdf> C:\Users\Ragheb\Desktop\test.html C:\Users\Ragheb\Desktop\new.pdf

What did I do wrong? Or what am I missing?

NOTE: I also tried to simply write a website url in the first link like (http://google.com) but it didn't work neither

Circumpolar answered 1/11, 2015 at 10:17 Comment(3)
See point #3 under the header "How do I use it?" on that very page you linked to. It's quite large, hard to miss.Yukyukaghir
Yeah, I mentioned above that I'm bad at command prompt. Anyway I tried this before posting the question and also now, it didnt work. (I went to the folder and wrote this same command)Circumpolar
Did you really put that ">" sign in your command line as you have it in your question? Can't imagine that's needed and I'm pretty sure it's going to screw things up. Also "it didn't work" isn't really very useful. What happened when you did this, I'm assuming you got an error message, perhaps you should share that?Scandic
C
10

Solved at last, I thought the directory was wkhtmltopdf, but I should go to bin (binaries)... Maybe they should mention this in the guide.

cd C:\Program Files\wkhtmltopdf\bin Then the command (wkhtmltopdf> C:\Users\Ragheb\Desktop\test.html C:\Users\Ragheb\Desktop\new.pdf)

Circumpolar answered 2/11, 2015 at 8:21 Comment(0)
P
2

You can also just add C:\Program Files\wkhtmltopdf\bin\ to your environmental variables (and reboot) to not have to be in the folder

Priapus answered 24/3, 2023 at 17:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.