| Login | Bugs & Features | Documentation | Download | Forums | ||
Articles · Developer Guide · Search Help HTMLDOC 1.8.28 Software Users ManualContents Previous Next Calling HTMLDOC from PerlPerl scripts offer the ability to generate more complex reports, pull data from databases, etc. The easiest way to interface Perl scripts with HTMLDOC is to write a report to a temporary file and then execute HTMLDOC to generate the PDF file. Here is a simple Perl subroutine that can be used to write a PDF report to the HTTP client:
sub topdf {
# Get the filename argument...
my $filename = shift;
# Make stdout unbuffered...
select(STDOUT); $| = 1;
# Tell HTMLDOC not to run in CGI mode...
$ENV{HTMLDOC_NOCGI} = 1;
# Write the content type to the client...
print "Content-Type: application/pdf\n\n";
# Run HTMLDOC to provide the PDF file to the user...
system "htmldoc -t pdf --quiet --webpage $filename";
}
Contents Previous Next | ||||||
| Copyright 2011 by Michael R Sweet. All rights reserved. | ||||||