Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: Displaying PDF files via CGI::Application

by weierophinney (Pilgrim)
on Sep 03, 2003 at 02:40 UTC ( #288489=note: print w/replies, xml ) Need Help??

in reply to Re: Displaying PDF files via CGI::Application
in thread Displaying PDF files via CGI::Application

You are seeing the headers in your browser window, indicating that some process has already sent a set of headers to your browser before the headers you are intending

Absolutely correct. CGI::Application has a special method for defining headers; if you don't follow it, it will send 'text/html' as the doctype.

To override the headers, the OP used the appropriate construct:

  • $self->header_props(-type=>'application/pdf'...);
The only thing I would add is that the CGI::Application POD says that header_props should be used in conjunction with header_type:
  • $self->header_type('header');
might do the trick; however, that's the default value.

My only other suggestion to the OP is to look and see if another print statement might be happening somewhere earlier in the process -- try running the application from the command line and look at the output for any whitespace preceding the headers.

  • Comment on Re: Re: Displaying PDF files via CGI::Application

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2020-11-26 10:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found