Gossamer Forum
Home : Products : DBMan : Customization :

Printout the record on the printer

Quote Reply
Printout the record on the printer
Hi !

I would like to make possible to print the record to the printer in the same form which is on the search results but without header nor footer. I have read some posts regarding this but I didn't understand them a bit. Basically I need similar mod like it is mod to send a record by e-mail; so after each record I have link to print the record out on the printer.
How can I achieve this in a simple way?

Regards,

Sasa
Quote Reply
Re: [atomant] Printout the record on the printer In reply to
This is an example of the version that I use. It will open the printable version in the browser. When they are done printing they can use the back button to return to the database.

Create a subroutine - sub html_printable -- (page layout using your fields that you want on the printout version.

sub html_printable {
#---------------------------------
my (%rec) = @_;

%rec = &get_record($in{$db_key});
$rec{'Lyrics'} =~ s/\n/<BR>/g;

&html_print_headers;

print qq|
<html><head><title>$rec{'Song_Title'}</title></head>
<BODY BGCOLOR="#FFFFFF" TEXT="#110000" LINK="#CC00FF" VLINK="#00CC33" ALINK="#000000">

<CENTER>$sitelogo<P>
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR><TD><$font>ID: $rec{'ID'}</FONT></TD><TD align=right><$font>Date:&nbsp; $rec{'Date'}</FONT></TD></TR>
<TR><TD colspan=2>&nbsp;</TD></TR>
<TR><TH colspan=2>$rec{'Artist'}</TH></TR>
<TR><TD colspan=2>&nbsp;</TD></TR>
<TR><TD><$font>Song Title:</FONT></TD><TD><$font>&nbsp;<B>$rec{'Song_Title'}</B></FONT></TD></TR>|;

print "<TR><TD><$font>Album/CD:</FONT></TD><TD><$font>$rec{'Album'}&nbsp;</FONT></TD></TR>" if $rec{'Album'};

print qq|<TR><TD><$font>Genre:</FONT></TD><TD><$font>$rec{'Genre'}&nbsp;</FONT></TD></TR>
<TR><TD colspan=2>&nbsp;</TD></TR>
<TR><TD colspan=2><$font>Lyrics:<P></FONT></TD></TR>
<TR><TD colspan=2><$font>$rec{'Lyrics'}</FONT>&nbsp;</TD></TR></TABLE></CENTER></BODY></HTML>|;
}

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

In sub html_view_success

before the line: $page_title = "Search Results";

add

## print view of record ##
if ($in{'view_printable'}) {
&html_printable (&array_to_hash(0, @hits));
return;
}
### end print record code ###

Add a link in html_record_long

print qq![ <A HREF="$db_script_link_url&view_records=1&view_printable=1&$db_key=$rec{$db_key}&ww=1">Printable Format</A> ] !;

Hope this helps

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Printout the record on the printer In reply to
Code:
my (%rec) = @_;

%rec = &get_record($in{$db_key});

Why are you using my %rec = @_ and then overwriting it straight away?

Last edited by:

Paul: Oct 6, 2002, 3:43 AM
Quote Reply
Re: [LoisC] Printout the record on the printer In reply to
Thank you Lois, this works fine for me.

SasaWink