To use the PDFreactor Perl API simply copy the PDFreactor.pm to a directory of your webserver where Perl is enabled (by e.g. CGI or mod-perl).
Then include the PDFreactor.pm with:
require "PDFreactor.pm";
With just a few lines you can create and directly show PDFs inside your Perl webapplication:
my $PDFreactor = PDFreactor -> new();
$PDFreactor -> setAuthor("Myself");
$PDFreactor -> setAddLinks('true');
$PDFreactor -> setAddBookmarks('true');
$result = $PDFreactor -> renderDocumentFromURL("http://www.realobjects.com");
$error = $PDFreactor -> getError();
if ($error ne undef) {
print "Content-type: text/html\n\n";
print "Error during rendering: ".$PDFreactor -> getError();
} else {
print "Content-type: application/pdf\n\n";
print $result;
}To directly output the PDF to the browser please use the following code before printing the result:
binmode(STDOUT);
PDFreactor methods in the Perl API docs for all avaible options.