How Do You Convert HTML To PDF In Linux Script?
To convert an HTML file to a PDF file in a Linux script, you can use PyODConverter. It uses the popular OpenOffice suite to convert HTML files to PDFs. However, this utility has one major drawback: it can be very slow, especially if you need to convert many files. (Also, you may not be able to install OpenOffice on your computer.) Another solution is to use the free and open source command-line utility XHTML2PDF (or Pisa) inside of your Linux script. Install XHTML2PDF. The simplest way is to use Python’s “easy_install” utility. See the documentation in the References section for details. Call Pisa from your Linux script. It takes as input the file name of an HTML file or a URL. For example, the command “xhtml2pdf test.html” converts the file “test.html” to a PDF document called “test.pdf.” Troubleshoot the conversion process. If the file does not convert, use the “-d” and “-w” switches to find out what’s wrong.