You should return the FDF contents and not the PDF contents:
Here is an example that returns an FDF file based on a form submission:
#
# This is the key to returning the FDF file
#
print "Content-type: application/vnd.fdf\n\n";
#
# Some adobe magic ...
#
$fdf = "\%FDF-1.2\n\%\a\a\I\O\n\a\n1 0 obj \n<< \n/FDF << /Fields [
";
#
# Return the fields passed to script back in an FDF file
# (build up the FDF string)
#
@names = $query->param;
foreach $item (@names)
{
$pvalue = param($item);
$fdf .= "<< \/V (".$pvalue.")\/T (".$item.")>>\n";
}
#
# Insert your server host name and PDF file name
#
$fdf .= "\n] \n/F
(http://yourserverhost/yourpdffile.pdf)>>\n>>\nendobj\ntrailer\n<<\n/Root 1
0 R \n\n>>\n\%\%EOF\n";
#
# example of field value substitution
# substitute the value in the FDF field named form.client.name.last
with value of lastname
#
$fdf =~ s/(.* \/V \()(.*)(\)\/T
\(.*formname\.client\.name\.last.*)/$1$lastname$3/ms;
#
# Send the fdf file back. The PDF is referenced from the FDF file.
#
print $fdf;
-----Original Message-----
From: Jean-Paul Felix [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 7:58 AM
To: perlweb (E-mail)
Subject: cgi and acrobat fdf/pdf files
Following some suggestions made on this list about offering pdf files for
download.
I have made a pdf file with form fields.
I have created a script which builds an fdf file which puts the correct
values in the form fields.
If I open the fdf locally it shows the correct values but I'm not sure how
to call this at the end of the cgi script.
I'm using:
print redirect("../new.pdf");
which opens acrobat in the browser but the form data in ../new.fdf is not
displayed.
I would like the cgi script to open the pdf in browser with the new.fdf data
in the form fields.
Thanks for any info.
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web