[l2h] Print Button??

Julius Smith Julius Smith <jos@w3k.org>
Thu, 29 Jul 1999 12:00:55 -0700


At 10:31 AM 7/29/99 -0400, John McKitterick wrote:
>I'd like to be able to add a button similar to the navigation buttons
>that would allow the viewer of the html to print the postscript file
>output by latex and dvips, since that looks better on paper than the
>printed html does.

Here's how I do something like this.  At the bottom of every page I have hyperlinks for downloading either a compressed PostScript or PDF version of the current document.  In Navigator on Windows, the PDF version loads directly into the browser from where it can be printed.  The anchor text can be changed to an IMG to make it a button as you wish.  I don't know how you could make it print directly from the button press, however.  I make no claims for cleanliness or elegance of my solution, but it works well enough for me.

In the document directory, I have an init file (for use with the -init_file command-line option) containing the following (randomly chosen example):

------------------------------------------------------------------------------------------
$JOSDOCDIR = "cs";
$JOSDOCTITLE = "Efficient Synthesis of Stringed Musical Instruments";
$JOSDOCAUTHORS = $JOS;
$JOSDOCPUBINFO = $ICMCP . " (ICMC-93, Tokyo), pp. 64-71, \n" . 
		 $CMA . ", 1993";
$INBOOK=1;
$ADDRESS= &make_jos_address;

1;	# This must be the last line
------------------------------------------------------------------------------------------

Then,  in my ~/.latex2html-init file, I have code for generating my own info
at the bottom of every page:

------------------------------------------------------------------------------------------
...
$JOSHOME = "http://ccrma-www.stanford.edu/~jos";
$JOS = "<A href=\"" . $JOSHOME . "/\"> Julius O. Smith III</A>";
$JOSSHORT = "<A href=\"" . $JOSHOME . "/\"> JOS</A>";
$JOSEMAIL = "<A href=\"mailto:jos\@ccrma.stanford.edu\"> 
			      jos\@ccrma.stanford.edu</A>";

$UPDATENOTICE = "Copyright &#169; <I>$address_data[1]</I> by " 
	. $JOS . "<" . $JOSEMAIL . ">";

$CMA = "<A href=\"http://music.dartmouth.edu/~icma/icma.html\">
	Computer Music Association</A>";
$ICMCP = "<B>Proceedings of the International Computer Music Conference</B>";

$STDADDRESSNONAME = "<A href=\"http://www-ccrma.stanford.edu/\">
	Center for Computer Research in Music and Acoustics (CCRMA),</A>
&nbsp;
<A href=\"http://www.stanford.edu/\"> Stanford University</A><BR>
<A HREF=\"http://www-ccrma.stanford.edu/\">
	<IMG SRC=../icons/CCRMALogoSmall.gif alt=\"CCRMA\"></A>\n";

$STDADDRESS = "<HR>" . $UPDATENOTICE . "<BR>\n" . $STDADDRESSNONAME;

sub make_jos_address {
	$ADDRESS = "<HR>" . &make_josdocdir_href . "<BR>\n" . 
	$JOSDOCAUTHORS . "<BR>\n" . 
	$JOSDOCPUBINFO . ".<BR>\n" . 
	"<HR>" . 
	"Download " . &make_josdoc_pdf_href . "<BR>\n" . 
	"Download " . &make_josdoc_ps_href . "<BR>\n" . 
	($INBOOK ? 
		("Visit the " . 
		"<A HREF=\"../smithbook/smithbook.html\">book</A>" . 
		" containing this material.<BR>\n")
		: "") . 
	"<HR>" . $UPDATENOTICE . "<BR>\n" . $STDADDRESSNONAME;
}

sub make_josdocdir_url {
	$JOSDOCURL = $JOSHOME . "/" . $JOSDOCDIR;
}

sub make_josdocdir_href {
	# Assumes $JOSDOCDIR, $JOSDOCTITLE and $JOSHOME are defined
	$JOSDOCHREF = "<A HREF=\"" . &make_josdocdir_url . "/\"> ``" .
	$JOSDOCTITLE . ",'' </A>";
}

sub make_josdoc_ps_href {
	$JOSDOCPSHREF = 
	"<A HREF=\"./" . $JOSDOCDIR . ".ps.gz\"> " .
	"compressed PostScript version (" . $JOSDOCDIR . ".ps.gz)</A>";
}

sub make_josdoc_pdf_href {
	$JOSDOCPSHREF = 
	"<A HREF=\"./" . $JOSDOCDIR . ".pdf\"> " .
	"PDF version (" . $JOSDOCDIR . ".pdf)</A>";
}

sub make_jos_stdaddress {
	$STDADDRESS = "<HR>" . 
		"Download " . 
			&make_josdoc_pdf_href . " or " .
			&make_josdoc_ps_href . "<BR>\n" . 
		"<HR>" . $UPDATENOTICE . "<BR>\n" . $STDADDRESSNONAME;
}

$ADDRESS = $STDADDRESS;

---------------------------------------------------------------------------------------------------

At 10:31 AM 7/29/99 -0400, John McKitterick wrote:
>I'd like to be able to add a button similar to the navigation buttons
>that would allow the viewer of the html to print the postscript file
>output by latex and dvips, since that looks better on paper than the
>printed html does.
>
>Is there a way of doing this inside of l2h, or does this require more
>html and cgi than I want to know about?? I don't mind if the button's
>functionality is specific to Netscape...
>
>--
>John McKitterick                         jbmck@batc.allied.com
>AlliedSignal Microelectronics and Technology Center
>Columbia, MD                             (410) 964-4068
> --------------------------------------------------------
>| "It's tomorrow that counts. So you worry all the time.   |
>| It never ends. Lord, baseball is a worrying thing."         |
> --------------------------------------------------------
>