To make browser show pdf file, we can:
Use html embed
<embed width="100%" height="600" src="https://www.example.com/1.pdf"> </embed>
or Open a pdf url by browser.
However, these two methods of displaying pdf file is hard to make some control, for example, if we only want to valid user to read pdf, how to control? To do this, we need output pdf file by php script. In this tutorial, we will show you how to do.
Set http response header
Ouptput pdf file
pdf = '1.pdf'; echo file_get_contents(pdf);
Then pdf file will be displayed in our browser, we can implment some control in this php page.