The easiest way to convert  HTML/XML (wtih CSS Style, JavaScript) to PDF in LINUX/Ubuntu through Command Line by following this method will work 100%.

Convert HTML/XML to PDF LINUX/Ubuntu Command Line

5 Steps to convert HTML/XML to PDF in Linux/Ubuntu Through Terminal Command Line

  1. Download Prince Apps for your Linux Distro. Here you will see many options. Choose deb/tar.gz/rpm etc for your device.
  2. After download completion, install from Ubuntu Software Center or manually.
  3. After installing complete, open Terminal by Ctrl + Alt + T.
  4. Convert Downloaded HTML page to PDF: Keep HTML file in Home directory. Assume, your file name is index.html , then run the following command.
    prince index.html
    It will converted a PDF file with index.pdf in your home directory. If you want to rename (assume hello.pdf instead of index.pdf) automatically from terminal, then run the following command.
    prince index.html -o hello.pdf
  5. Convert Webpage to PDF: If you want to convert directly webpage (suppose then run the following command.
    prince -o google.pdf
  6. To get more option run
    prince --help
    from terminal.
  7. To know more please visit official doc of Prince.
Have got this article helpful or not working? Put your comment below.