LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-02-2015, 04:49 PM   #1
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Rep: Reputation: Disabled
Smile 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)
 
Old 08-03-2015, 11:12 AM   #2
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
If it is possible with Firefox and a pdf printer in command-line, I want to know how too.
 
Old 08-03-2015, 01:47 PM   #3
dlee99
LQ Newbie
 
Registered: Mar 2006
Location: Berkel en Rodenrijs
Distribution: Slackware64-current
Posts: 21

Rep: Reputation: 2
I am using the Print To Pdf extension with Firefox

Sufficiant for me
 
Old 08-03-2015, 01:57 PM   #4
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
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.
 
Old 08-03-2015, 02:11 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,622

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
debian console-mode server.
--- and ---
Now I want to install chromium browser
you really do not install a GUI browser in a text only environment


if you REALLY want X on a server ???
install it and a desktop environment
 
Old 08-03-2015, 02:14 PM   #6
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
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
 
Old 08-03-2015, 02:18 PM   #7
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
look at : http://stackoverflow.com/questions/9...ct-to-x-server
and especially the line :
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf "$@"
 
Old 08-04-2015, 05:32 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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.
 
Old 08-04-2015, 06:49 AM   #9
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
imagemagick, ps etc dont do the job
htmldoc has a GUI interface and is nos as powerful as a webbrowser or whtmltopdf
 
Old 08-05-2015, 04:44 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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.
 
Old 08-05-2015, 09:20 AM   #11
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
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 ?
 
Old 08-05-2015, 04:59 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
https://www.msweet.org/documentation...1/HTMLDOC.html
 
Old 08-06-2015, 04:46 AM   #13
sylvain555
LQ Newbie
 
Registered: Aug 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
This link explain the GUI version of htmldoc
 
Old 08-06-2015, 03:55 PM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Code:
man htmldoc
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
basic idea of programming done to convert html pages to pdf using linux yashwanth chowdhry Programming 1 01-01-2011 10:58 AM
How to merge linked html pages into a single pdf. jan.goyvaerts Linux - Software 7 03-21-2010 05:12 PM
Convert pdf to html or txt or remaster the pdf? jago25_98 Linux - Software 1 12-13-2005 01:11 AM
Is there an app which can convert pdf to, e.g., html? kornerr Linux - General 2 08-29-2005 11:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration