Solved

How to print a HTML file in unix using a command?

Posted on 2006-06-19
6
243 Views
Last Modified: 2013-12-27
Hi,

  I need to print html files in unix using a command. The print out should not have any html tags and it should look like what we see in browser.
 The command should be executed in back ground so that i can use this command in my java program for html prints.

  On windows XP we can right click a file and send it to a printer,windows automatically converts that and prints the page.

  I am looking something similar in unix using a command.

  Does any body know any command.

 ***It is urgent****

Thanks
0
Comment
Question by:madhurikg
  • 2
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
Nukfror earned 500 total points
ID: 16935584
You might considering using html2ps:

http://user.it.uu.se/~jan/html2ps.html

and then print the result Postscript document to the print assuming your printer is PS ready.
0
 
LVL 10

Expert Comment

by:Nukfror
ID: 16935661
Ahhh !!! Maybe even better.  If you take a look here:

http://www.blastwave.org/packages/htmldoc

You'll see blastwave has the HtmlDoc package.  The htmldoc page makes this thing look pretty nice !!

http://www.htmldoc.org/

"HTMLDOC converts Hyper-Text Markup Language ("HTML") input files into indexed HTML, Adobe® PostScript®, or Adobe Portable Document Format ("PDF") files.

HTMLDOC supports most HTML 3.2 elements, some HTML 4.0 elements, and can generate title and table of contents pages. The 1.8.x releases do not support stylesheets.

HTMLDOC can be used as a standalone application, in a batch document processing environment, or as a web-based report generation application."

So similar concept as html2ps but using htmldoc instead.
0
 
LVL 3

Expert Comment

by:anumalas
ID: 17097414
Hi

If you are having mozilla installed on your mechine  you can print with that command

to invoke mozilla command line simply type

$mozilla and to search the print optings $mozilla -help

Use mozilla  and lpr to print html content. I did not get exact command to give

Hope this will help :)
0
 
LVL 3

Expert Comment

by:anumalas
ID: 17097489
check the bellow script

test.sh

//First export the mozilla environment..

$Filename= "yourfilename";
mozilla -browser  & $Filename; //check the syntax to run mozilla in background;
lpr -d<printername>; // there is no need to specify filename;
// write a code to get mozilla's process id using ps
kill -9 <pid of mozilla>; //if you will not kill mozilla it will run in background continiously

Its just a trail chek and implement script

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question