Im using the perl modules PDF::Create and PDF::Reuse to add some form input
fields to a pdf.
I then want to be able to download into the browser the created pdf file.
I seem to be able only to create the file in the cgi-bin directory
( prDocDir('/tmp/') seems not to work;
I can open the file (using xpdf) directly
eg
#!/usr/bin/perl -w
# perl stuff to create a pdf file
I then use a bit of perl to write the new page page.
print "content-type:text/html\n\n";
print '<HTML><HEAD><TITLE></TITLE>';
print '<body>';
print '<a href="http://webserver.com/cgi-bin/form.pdf">Download your
file</a>';
print '</body></HTML>';
This gives me a 500 Internal Server Error
bash-2.05b# tail /etc/apache2/logs/error_log
[Sat Mar 13 22:15:54 2004] [error] [client 127.0.0.1] Premature end of
script headers: form.pdf
[Sat Mar 13 22:15:54 2004] [error] [client 127.0.0.1] (2)No such file or
directory: cannot access type map
file: /home/httpd/errorHTTP_INTERNAL_SERVER_ERROR.html.var
ie it thinks the file is a script!!
the cgi-bin directory is configured with
Options +ExecCGI directive
bash-2.05b# cd /etc/apache2/conf/vhosts/
bash-2.05b# cat vhosts.conf |grep pdf
bash-2.05b# pwd
/etc/apache2/conf
bash-2.05b# cat commonapache2.conf |grep pdf
AddIcon /icons/layout.gif .html .shtml .htm .pdf
ie there are no stray config things
Can i allow apache to serve pdf ( or txt) files from a cgi-bin directory ?
>> Stay informed about: pdf files from the cgi-bin directory