简体   繁体   中英

How to embed a pdf into a html page for android browsers

So,

At the moment I embed a base64 encoded pdf into a html page using iframe and I have no problem with this but I want to display it also on android browsers like chrome and firefox.

I also tried object or embed tag but none worked.

What should I do ?

You should try Viewer.JS or PDF.JS . If none of those work, you could possibly use Google Docs Viewer . This site will help you generate the URL for that : iTools.com . I prefer Google Docs currently because the performance is a little sluggish using both of those Javascript viewers. Keep in mind that in order for the Google Docs Viewer to work, you must have the file published to the web and accessible for Google's servers.

Another option would be to use a conversion library (such as imageMagick) to turn the PDF into an image and then offer a link to the full file. If your html is going to be viewed by other devices such as desktops, you could always check to see if Adobe Reader is installed and then, if not, offer an image instead with a link to the file. I use PluginDetect to check for support for PDFs.

There are other commercial options like iSSUU or FlexPaper but I don't have any experience with those. iSSUU is a software service that allows embedding viewers on your website and FlexPaper is a software that you buy and install to your website.

This is assuming you're trying to embed a PDF to a website. :/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM