Using Chromium browser to convert HTML to PDF pages on Debian console-mode server
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using Chromium browser to convert HTML to PDF pages on Debian console-mode server
Hi all !
I want to convert HTML pages (by their URL) to PDF pages on my debian console-mode server.
I tried several solutions.
The last best was whtmltopdf but it cut pages into images and tables.
Now I want to install chromium browser and print as PDF (the PDF functionnality is included in chromium) the HTML of my URL.
I want to use chromium on command line.
But when I launch chromium in Putty I get the error message :
" Gtk: cannot open display:"
This is normal because I am not in GUI mode in my server.
But with whtmltopdf I have found a trick to simulate a GUI in background.
Is this possible with chromium and what is the magick command-line to do my job ?
Thank you !
Bye !
Sylvain Ard (from France)
OK and can you explain to me how install this extension on command-line and what is the command line to do the conversion because itis a server and there is no GUI.
yes but I want to use only the feature of conversion of chrome and not the GUI interface.
And I want to use this conversion by a script PHP and I can't interface PHP and a GUI interface like chrome but with the command-line.
like this >> http://dmesg.fr/astuces/122-converti...ne-de-commande
the trick is to emulate in background on a GUI hidden the GUI interface
i daresay there must be a solution that doesn't involve a "virtual X server".
there's a few low-level tools that you maybe can use (ps, ps2pdf, gd...).
a quick search on my debian server gives me "htmldoc - HTML processor that generates indexed HTML, PS, and PDF".
i also think imagemagick might be up for the task (has php support, too).
i'm sure there's a few more utilities.
if you want help with this, you might want to elaborate on "don't do the job".
meanwhile, i compiled htmldoc without a gui and succesfully converted my bookmarks.html to bookmarks.pdf, on the command line.
i guess it will still pull in a lot of graphical dependencies, because pdf is a (partly) graphical format.
if you can use the arch user repository, here goes: https://aur4.archlinux.org/packages/htmldoc/ (my modified PKGBUILD)
if not, you can still glean relevant info from the PKGBUILD to ./configure, make and install yourself.
OK I will test htmldoc.
Can you tell me what command-line I have to do to install it on my server and an example of a command-line of its use, please ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.