Forum How do I...?

Perl mod_perl - creating PDF

pincusgl
I have a script:

The Following line takes an existent HTML file and converts to PDF = Works no problem:
system("prince up_prince_test.html -o pincus.pdf");


The Following is where I send html thru a string directly But = Does not Work:
open(PRINCE, "| prince - yankel.pdf");
print PRINCE "<html><body><h1>Hello, world!</h1></body></html>";
close(PRINCE);


I even tried the following: and it just open a blank PDF saying it cannot load the PDF
print "Content-Type: application/pdf\n\n";
open(PRINCE, "| prince -");
print PRINCE "<html><body><h1>Hello, world!</h1></body></html>";
close(PRINCE);
exit;


If I do the same for a text file (Not prince pdf) it works no problem
open(my $fh, '>', 'racker.txt');
print $fh "My first report generated by perl\n";
close $fh;


I would really really appreciate any help
mikeday
The second example requires a -o argument, eg. "| prince - -o yankel.pdf", but the second example should work, can you try running it directly from the command-line instead of through the CGI script and see if it behaves differently?