Background: Its\' a e learning website, when user in the learning stage, it will show content for reading at first 3 pages, and after that it will need user
It looks like you're trying to display the PDF inline. To do this you should create an IFRAME with a source that points to your PDF creation script. That way the browser can choose whether or not it can display the PDF, if it can't then the file will be downloadable.
Main point: the browser doesn't know how to interpret what you're giving it.