felgall: If the browser supports displaying PDFs in the browser then the following is the simplest solution: <div><img src="something.pdf" alt="unfortunately your browser doesn't display. displaying pdf in iframe PHP Ask Question Asked 10 years, 8 months ago Modified 10 years, 8 months ago Viewed 2k times 1 i am creating a javascript function that displays pdf files stored in mysql database Read this first ! It will now look something like this. If the browser doesn't support PDF embedding, which still happens frequently with browsers on mobile devices, the end-user will see nothing. Why I implemented my own JSON.stringify() and console API, 5 websites to learn Frontend-web development faster, Learn the difference between CSS & JavaScript, Loading components dynamically in angular, Nuxt Ionic: Using Nuxt, Prisma and Ionic Framework to Build Full Stack Mobile Applications,