FAQ : Frequently Asked Questions
FAQ Table of contents
blue line
41. Q:  How can I display a PDF stream file without displaying its URL?

A:Apache HTTP server has no problem in displaying a stream file PDF by requesting its URL, provided that it is authorized to access the stream file path (directory). However, in doing so, the browser displays the URL of the stream file and this may result into a security hazard (you may want not to display the URL of the PDF, in order to prevent access to other similar PDFs).

Another way to display a stream file (not necessarily a PDF) is that of using a CGI program which reads the stream file, copies it into the output buffer and sends the buffer to the browser. Of course an appropriate HTTP header is needed to let the browser knowing the application type of the file.

The advantages of this approach are two:

  1. No special HTTP directive is needed to access the stream file, as this is done by the CGI
  2. The browser displays the URL of the CGI program, without letting the user know about the PDF path.

Such a CGI program is already available and you may invoke it through the URL

However, if you do so, CGI program dspstmf does not know the stream file you want to display and will ask you to enter its path.

What you have to do, is to call the CGI program dspstmf AFTER putting an environment variable named XSTMF and containing the stream file path.
See the following example:
D dspstmf         pr                  extpgm('CGIDEV2/DSPSTMF')
where path is the path to the stream file, for instance:

blue line