This is how: create HTML code:
<a href="createdFile.pdf">This is your PDF document</a>
It sounds like a joke, but I'm serious. The user clicks on this anchor's text and uses the option the browser offers.
There is the thing: PDF is not a part of W3 standards and is quite foreign to Web. Don't be confused by the fact that many browsers actually show PDF files directly. Even though this feature is popular, it is totally optional, often implemented as a 3rd-party plug-in. You should never assume that the user has anything at all to view PDF. This is not a problem at all, because the user always is given an option to save the file and view it later.
Now, as you dynamically generate PDF file, you may want to avoid saving the file in the file system of your server's host. Then the solution is: your URL should be some PHP file "createPDF.php", instead "createdFile.pdf". This PHP script can generate PDF context directly to the output stream of the current HTTP response. Before you output a single byte, you need to generate appropriate content type header. The content type string should be "application/pdf".
Content types are standardized by IANA and can be found here:
Media Types[
^].
This is how you output an HTTP header via PHP:
PHP: header — Manual[
^].
Pay attention for the headers "content-type" and "content-disposition" in the code samples. See also:
RFC 2183 — Communicating Presentation Information in Internet Me (RFC2183)[
^].
—SA