📜 ⬆️ ⬇️

Url to PDF. Easy and trouble free

All good health.
I saw an interesting post about a wonderful service with a talking address: pdfmyurl.com
And the idea was born to write about an alternative, more interesting way (especially interesting for programmers, enthusiasts, and just console-loving people). More precisely, about the project, allowing to do the same, without using third-party service.

Briefly and essentially.
The project is open source.
Lives on code.google.com/p/wkhtmltopdf
Written using QT + Webkit. This, as for me, is a HUGE plus: cross-platform, extensibility, etc.
Essence: WebKit renders the page at the specified URL, and already the main part of the program creates a PDF and saves it.
The most excellent thing. Not without cons, of course. But for raking up a relatively clean material - the most it. :)
At the moment - can be used from under the console. However, nothing prevents to write an interface for it, doesn’t it? QT all the same!
To use, after the standard qmake-qt4 && make && checkinstall (make install) - without departing from the cash register of the console, we write:

wkhtmltopdf habrahabr.ru habrahabr.pdf -O Landscape -s A4

As a result, we get the main page of Habr, clean from banners, A4-size pages, landscape-oriented.
To view the available options should say:

wkhtmltopdf --help

So that. Your KO
')
Yes, pdfmyurl.com generates PDF almost AS IS (excluding flash). But who would want to have a hefty banner in PDF with interesting content? :)
As a bonus, wkhtmltopdf can also be generated from local HTML files.

Summarizing: the advantages of this project are more than cover the minuses. Give OpenSource to the masses!

UPD: I apologize to the readers, a similar topic was already on Habré, much more useful than mine. Thank you josser

Source: https://habr.com/ru/post/81375/


All Articles