How to convert HTML into endless one-page PDF via wkhtmltopdf

command lineconversionparameterspdfwkhtmltopdf

Currently when converting the PDF from given URL, like:

wkhtmltopdf http://superuser.com/ superuser.pdf

where it consist multiple A4 pages (so sometimes images are cut in the middle of the page).

My question is:

How do I convert HTML page into PDF format where the height is endless?

My preference is that you still should have editable/searchable document, not just an static image.


What I've tried already:

Best Answer

The wkhtmltopdf 0.9.6 Manual documents this parameter :

    --page-height      <unitreal>      Page height (default unit millimeter)

Therefore defining an enormously long page can be done via :

--page-height 10000cm
--page-height 100m

which both define a page of height of 100 meters (I mention both in case your wkhtmltopdf does not support m).

Not using wkhtmltopdf, I do not know if there is some upper limit to page-height, but you can find that empirically.

In addition you can try to add --disable-smart-width (width is not an error) and try for the moment the less ambitious --page-height 100cm.

In this man page there is a comment about disable-smart-width that it's only available using patched QT.

There is also another comment:

On the wkhtmltopdf website you can download a static version of wkhtmltopdf at http://code.google.com/p/wkhtmltopdf/downloads/list. This static binary will work on most systems and comes with a build in patched QT.

The project has moved elsewhere, so you might hunt there for such a version, or ask in the forums.