LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 01-23-2009, 09:17 AM   #1
jason7
LQ Newbie
 
Registered: Aug 2008
Posts: 10

Rep: Reputation: 0
Question converting .html files to pdf from the command line


is it possible to convert html files and make them a pdf?

they should like like the html page so the html tags should be interpreted.

thanks.
 
Old 01-23-2009, 10:09 AM   #2
David the H.
Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 5,327

Rep: Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199
There's an "html2ps" converter application that should work for you. I haven't tried it though, so I don't know how well it handles links or complex formatting. It will convert your page into a postscript file.

From there you can use ps2pdf (part of the ghostscript package) to get the final pdf version (most pdf viewers can also handle ps, but the file sizes are usually about 5 times larger, so it usually pays to convert them).
 
Old 01-23-2009, 10:32 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2010.12, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 9,290

Rep: Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350
Or this :

1) Print >> print to file >> page.ps

2) page.ps > print to pdf.
 
Old 01-23-2009, 10:54 AM   #4
David the H.
Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 5,327

Rep: Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199
Quote:
Originally Posted by knudfl View Post
Or this :

1) Print >> print to file >> page.ps

2) page.ps > print to pdf.
That's what I would usually have advised, but the OP said that the html links should be interpreted, so I don't think print-to-file is suitable in this case.

BTW: I thought I'd mention that there's also a free pdfedit program that might be useful if you need to clean some things up.
 
Old 01-23-2009, 10:55 AM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 112Reputation: 112
convert file.html file.pdf

This assumes you have imagemagick installed.
 
Old 01-23-2009, 11:01 AM   #6
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,438

Rep: Reputation: Disabled
I think html2ps and ps2pdf14 would be the easier way...but with the correct options.

See man html2ps
 
Old 01-24-2009, 08:46 AM   #7
renjithrajasekaran
Member
 
Registered: Jan 2009
Posts: 29

Rep: Reputation: 15
Is there a programmatic way of doing this ???

Linux Archive

Last edited by renjithrajasekaran; 01-25-2009 at 03:02 AM.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML to PDF Command Line App Luvz2Fly Linux - Software 1 12-03-2008 03:14 PM
cups-pdf command-line print .html pages without tags ? o5iri5 Linux - Software 1 08-06-2007 06:24 AM
How can I read pdf files at the command line? hansi umayangan Linux - General 8 09-02-2004 07:27 AM
print files in PDF or html format from the linux command line IBKnobel Linux - Software 3 07-12-2004 09:29 PM
Converting html files to pdf saurya_s Linux - Software 1 01-12-2004 06:49 AM


All times are GMT -5. The time now is 11:05 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration