Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed PDFs that work in all web and mobile browsers

My client asked me to create a page which contains PDF. I used Embed, Iframe tags, it worked in Mozilla but did not work in IE and Mobile browser.

I know that all browsers will read .pdf directly but I want it to be embed.

Is there any way?

Please help me..

like image 660
Silas Paul Avatar asked May 26 '11 11:05

Silas Paul


People also ask

Do mobile browsers support PDF Embedding?

It works perfectly in PC browsers, but a critical requirement for the pages is to have them compatible in mobile browsers due to its target users. Although image files work fine, PDF files are opened separately in the mobile browser and not embedded inline in the web page.

Can you embed an interactive PDF into a website?

Fortunately, Adobe has released Adobe PDF Embed API (PDF Embed), an easy way for you to incorporate a PDF directly into your website with just an easy snippet of code. It is entirely free to use and renders client-side within your web app. You don't have to learn a sophisticated PDF library, and it is super easy to do.

What is the best way to display a PDF in a web app?

Using a Simple Link It uses an HTML <a> tag which links to the PDF document. This is, on the one hand, is great, as it delegates the responsibility of dealing with the PDF to the platform itself (e.g. your Mac or PC or phone).

How do I make a PDF viewable in my browser?

In Chrome, go to the "Menu" icon, then choose "Settings." 3. Scroll to the bottom and select "Advanced." 4. In the "Privacy and Security" section, select "Content settings." 5. Scroll down and select "PDF documents," then switch it to "On."


2 Answers

If you give a link to the PDF on the web page, any browser will be able to download the file and then the user can open it in a PDF viewer of his choice.

If you want to embed the PDF document in a web page, then the browser needs to have a PDF plugin installed. This may not be the case with all browsers. The PDF will be displayed only if the PDF viewer application's plugin is registered with the browser.

The other way of embedding the PDF document is to use a server-side component that renders the PDF as ordinary HTML web page elements. Google has an embeddable PDF viewer.

Google Docs offers an undocumented feature that lets you embed PDF files and PowerPoint presentations in a web page. The files don't have to be uploaded to Google Docs, but they need to be available online.
like image 84
BZ1 Avatar answered Oct 12 '22 23:10

BZ1


You can also use Mozilla's pdf renderer written in javascript. It is rather complex getting started, but all options are there. It is the pdf reader available in Firefox and extensions exist for other browsers. Fun fact: It is by far the most starred library on github when searching for pdf.

like image 43
Simon Bengtsson Avatar answered Oct 13 '22 00:10

Simon Bengtsson