Wkhtmltopdf – A Smart Tool to Convert Website HTML Page to PDF in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

37 Responses

  1. Ismael Alvarez Wong says:

    Hi Ravi,

    I am getting the following error […network error: TimeoutError] because I has a proxy in my LAN. I found another solution, it’s to save as “local” the “web page, complete” & give it to input’s argument of command wkhtmltopdf.

    $ sudo wkhtmltopdf https://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ 10-Sudo-Configurations.pdf
    Exit with code 1 due to network error: TimeoutError
    $ sudo wkhtmltopdf toc "file:///path/10%20Useful%20Sudoers%20Configurations%20for%20Setting%20'sudo'%20in%20Linux.html"  10-Sudo-Configurations.pdf
    Loading pages (1/6)
    QFont::setPixelSize: Pixel size <= 0 (0)                     ] 45%
    Counting pages (2/6)                                               
    QFont::setPixelSize: Pixel size <= 0 (0)=====================] Object 2 of 2
    Loading TOC (3/6)                                                           
    Resolving links (4/6)                                              
    Loading headers and footers (5/6)                                           
    Printing pages (6/6)
    $ evince 10-Sudo-Configurations.pdf    <-- Shows OK the PDF

    Finally very good post

  2. Russ says:

    The instructions are lacking the steps of installing the includes, libraries, and man pages. Once the archive is extracted (as noted in the article), all of the files need to be copied to their respective locations as they are in the archive folder (i.e. stuff in the ‘include’ folder needs to go in the system’s /usr/include folder).

  3. kjlw99 says:

    Does anybody know from their testing, whether the outputted PDF’s are images of text or text on a page?

    If it is images of text, the text will not be selectable or copyable into another application.

    I prefer the PDF format, for all of my E-books and many of my comics; but I use Firefox with the mhtml add-on to get copies of articles that allow me to copy-paste into other applications if needed.

  4. Martins Almeida says:

    No GUI interface. Typing extensive command lines in XXI century? No thanks.

  5. Ted Waugh says:

    Hi Ravi.

    I’m a fairly new user. I used the root terminal in MX-16 to run the commands.

    Evince installed no problem.

    The tar downloaded to my user directory no problem

    The unpack exited with the following error:

    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now

    Any suggestions?

    • Ted Waugh says:

      Hi Ravi,

      I dropped the z from the unpack line and everything worked normally.

      Thanks for the entertainment! I enjoy learning more. Keep up the good work.


      • Ravi Saive says:


        Thanks for notifying us about that z option tar command, could you tell us on which Linux distro you have omitted the option? it will help us to add correct instructions in the article.

  6. Ananda Bhattacharjee says:

    wkhtmltopdf http://www.google.com.ph google.pdf
    bash: wkhtmltopdf: command not found

    /usr/local/bin/wkhtmltopdf http://www.google.com google.pdf
    Loading pages (1/6)
    Counting pages (2/6)
    Resolving links (4/6)
    Loading headers and footers (5/6)
    Printing pages (6/6)
    Please suggest me what to do now ?

  7. Jonus Joseph says:

    Hi Ravi,

    I am getting below error while trying this command. please check and advice me.

    [[email protected] tmp]$ wkhtmltopdf “https://www.google.co.in/?gfe_rd=cr\&ei=7n1LVeKNOMPCuAGDjoGACw\&gws_rd=ssl” /tmp/test/web/
    Loading pages (1/6)
    QPainter::begin(): Returned false============================] 100%
    Error: Unable to write to destination
    [[email protected] tmp]$


  8. Eddy says:


    Do we need to add crontab by using root username or nagios username?

  9. eddy says:


    Good article.

    I use this command to create
    wkhtmltopdf –username nagiosadmin –password XXXX “” /usr/local/nagios/report_daily/nagios_daily.pdf

    1. I want run this automatically by using crontab. How do i do it?
    2. I want to add this file at my nagios side.php. How?

    Thank you

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *