accessing FOP from chilisoft asp
Hi,
I've been asked to generate multi page pdfs from a database. I was wondering if it possible to install FOP(Formatting Objects Processor) on my server and then somehow access it from my asp pages using chilibeans?I'm not looking for the exact code but just some tips on the main procedures. I'm not 100% sure if I this is even possible. I have limite access to myd evelopment server and need to request changes via our service desk so don't have the freedom of insatalling packages willy nilly. FOP looks like ti would do the trick, has any one got any ideas?
Regards,
Euan
[606 byte] By [
euang] at [2007-11-26 10:32:26]

# 1
I use asp to create the pages - nothing new there but it makes it so easy to do.
I then use htmldoc (which is free). This converts any html page to a pdf on the fly. The clever bit is you can specify all sorts of hiddden tags (html comments) like page breaks in the html/asp output.
So you get easy to maintain asp/html page and then just call htmldoc as cgi on your web site, it runs the asp page, converts it to a pdf and outputs it to the visitor.
Duncan
# 3
For what it is worth here is an example cgi script that should work with htmldoc to save you some time.
All you need to do is install htmldoc (free version), update this to call an asp page of your choosing and stick it in your cgi area and all should work.
Duncan
#!/usr/bin/perl --
############################################################
############################################################
$form{'id'}="";
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
# Split the name-value pairs
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $buffer);
}
else
{# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
}
# Split the name-value pairs
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$form{$name} = $value;
}
$id=$form{'id'};
if ($id eq "") {
print "Content-type: text/html\n\n";
print "invalid call";
}
else {
# Make stdout unbuffered...
select(STDOUT); $| = 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 --fontsize 9 --header ... --footer ... --textfont Arial \"http://192.168.2.5/print.asp?id=$id\"";
}
exit;