Opening PDF or other file inside browser
Keywords: Opening PDF browser
Question:
I have built a selection box from a directory listing. But since the files to be viewed are PDF files, I am not sure how to open the files. What I get is a binary view of a PDF file. I believe that is because I am using the standard set of webout's used to create a html page. namely a command like this "WebOut('Content-type: text/html',2)". I think this is making the browser to think the file is a text file. If I leave the common webout commands out and just do a weboutfile command, the browser says the CGI application misbehaved by not returing a complete set of HTTP headers. Any ideas?Answer:
Yes, the WebOut is the problem. If you are sending a PDF file the webout should read something like...WebOut('Content-type: application/pdf',2)The "Content Type" line is required for the Web Server and WebBrowser to properly identify what is being sent.
Article ID: W14758