Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to print a perl script output in a printer freindly way?

Status
Not open for further replies.

gchen

Programmer
Nov 14, 2002
174
US
i have two PERL scripts -

a. calendar.cgi
b. printer friendly script - print.cgi

both are working fine by themselves. but i wish to let printer.cgi to read in the process result of claendar.cgi so i can let my visitor to print a no graphics calendar from the calendar search result.

the print.cgi basically is read in a file then drop those graphics related html tags and output a thin lean html page for printer. since the search result of my other script calendar.cgi is not a static html page, i am having program get it read into print.cgi.

i am clueless how to get this task done. they are on a linux box and i am wondering if there is any why i can read apache's utput to a file and go from there so something similar?

help please!!!!!

 
Take a look at the LWP::UserAgent module for getting the file(s) you need to read and HTML::parser for stripping your content to what you're looking for.

- Rieekan
 
Hi Rieekan,

Can you elaborate?

Say what should i do in order to be able to "look at LWP::UserAgent module?

the cgi script i have in running generate html page on the fly and are you saying such content is reading able at LWP::UserAgent? How can i get it? Once I have it, i am another script to process the "printer friendly version".

Anticipating your further assistance!!!!!
 
When you generate you HTML, you'll need to include page breaks
Code:
<p style="page-break-before:always">
Also ensure that your table or div widths don't go over the width of the page you're trying to print
HTH
--Paul

cigless ...
 
Hi Paul,

Thanks for the tip.

My problem is i need to find a way to read in the content generated by other cgi script on the fly first. it is not a static page and is processed and generated by perl cgi script.

any suggestion?

Thanks!

Gary
 
from
Code:
require LWP::UserAgent;
 
 my $ua = LWP::UserAgent->new;
 $ua->timeout(10);
 $ua->env_proxy;
 
 my $response = $ua->get('[URL unfurl="true"]http://search.cpan.org/');[/URL]
 
 if ($response->is_success) {
     print $response->content;  # or whatever
 }
 else {
     die $response->status_line;
 }

HTH
--Paul

cigless ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top