Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi that feeds up a PDF file

Status
Not open for further replies.

adumitrescu

Programmer
Jun 15, 2005
18
CA
Hello,
I need to write a cgi that returns a PDF file to the browser (as if they had clicked on a PDF link). My cgi can open the raw PDF file easily enough and push the data. What I'm not sure about is the pre-amble bits that preceed the actual PDF data stream (and possible post-amble bits).
Note: not that it matters to this topic, but I use Perl for my cgi work.
Thanks.

 
Did you mean this:

Code:
print "Content-Type: application/pdf\n\n";
print $binary_pdf_data;
 
Hi

That way if the visitor wants to save the PDF file, the default file name in the Save as dialog will be the script file's name. If you want to send a proper name for the PDF file, add a [tt]Content-disposition[/tt] header line too.
Code:
print "Content-Type: application/pdf
Content-disposition: inline; filename=$pdf_file_name
\n";
print $binary_pdf_data;

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top