Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

how to output to pdf from a perl script

by thaigrrl (Monk)
on Jan 16, 2001 at 19:38 UTC ( #52253=snippet: print w/replies, xml ) Need Help??
Description: I had problems when trying to generate a pdf file with perl and outputting to MSIE 5.0. To fix this, I did content type = application/pdf. Thanks to help from wonderful perl monks I found out that I could do this. :) Thanks for the nifty trick! I just thought I'd share for those who don't know.
the url was simple....
by simply adding .pdf to the end of the URL, Microsoft's dumb MIME content override was tricked.
Replies are listed 'Best First'.
Re: how to output to pdf from a perl script
by merlyn (Sage) on Jan 16, 2001 at 23:01 UTC
Re: how to output to pdf from a perl script
by skeight (Novice) on Jan 25, 2001 at 03:59 UTC
    couldn't you also just do this at the beginning of the html:
    print "Content-type: application/pdf\n\n";
    correct me if I'm wrong but I'm pretty sure this would work


      You should certainly be including that in your HTTP header, but IE prefers to pay attention to the file extension. If you have a URL such as, and that CGI script generates a PDF file and sends it along, IE won't see it as a PDF, it will see it as a .CGI file.

        Ahhh, Now I see. Thanks for the input on that one. I wasn't aware of that...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://52253]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2022-08-13 08:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found