Loading...
 

wkhtmltopdf

wkhtmltopdf is an open source (LGPLv3) command line tool (Simple shell utility) to render(convert) HTML into PDF using the QT Webkit rendering engine. It runs entirely "headless" and do not require a display or display service. There is also a C library.
Source: http://wkhtmltopdf.org

There are two options (wkhtmltopdf 0.13 aims to simplify this)

  • standard: fewer features, requires X (and if your GNU/Linux OS is virtualized, it perhaps won't work)
  • patched QT: more features, doesn't require X (headless)

OpenHub

Configure

To configure with Tiki, go to General » General Settings admin panel (tiki-admin.php?page=general&cookietab=2) and set "PDF from URL" to "WebKit (wkhtmltopdf)". Then in the "WebKit path" insert for example this full path to the executable file: /var/local/bin/wkhtmltopdf-amd64 (on a Linux 64-bit system, the path can be different depending on the installation).

To know what “WebKit path” to provide
which wkhtmltopdf

which will report something like:
/usr/local/bin/wkhtmltopdf


Installation for various operating systems

If using wkhtmltopdf v 0.13. with no X11 window system
(...)
 /**
     * @param $url
     * @return mixed
     */
    private function webkit( $url )
	{
(...)
		// Run shell_exec command to generate out file
		// NOTE: this requires write permissions
		$quotedFilename = '"'.$filename.'"';
		$quotedCommand = '"'.$this->location.'"';
		
		`xvfb-run $quotedCommand -q $arg $quotedFilename`;

Issues

  • There might be problems for incorporating images or external content to the pdf file. Please see the wkhtmltopdf documentation.
  • If you are having issues with password protected pages, trying activating Token Access


Collection of References on doc.tiki.org

  • Print general info about printing
  • PDF general overview about PDF creation in Tiki
  • mPDF create PDFs from Tiki content (advanced library that works even on shared hosting). Recommended for Tiki18+
  • PluginPDF alter default settings of mPDF per wiki page
  • PluginPDFPageBreak add a page break for PDFs created with mPDF
  • PluginMediaPlayer display PDF file from file gallery
  • PDF.js viewer PDF.js from Mozilla
  • ViewerJS: a script to view PDFs and ODFs, which bundles WebODF
  • PluginArchiveBuilder Generate a zip file, including PDFs from wiki pages
  • WeasyPrint A PDF generation option in Python
  • wkhtmltopdf create PDFs from Tiki content (needs root installation)
  • dompdf once used for PDF print of slideshows

Aliases

wkhtml2pdf
wkhtmltoimage

List Slides