If I'm not mistaken, Google Docs offers the means to display a PDF that is stored on the same server as the web page via an <iframe>
, but I need to know how I can do this in a cross-browser compliant way.
One popular option is that you upload the PDF file to an online storage service, something like Google Drive or Microsoft's OneDrive, make the file public and then copy-paste the IFRAME code provided by these services to quickly embed the document in any website.
When working in the Pages application, which is part of Apple's iLife suite of productivity software, you can embed images into your word processing and layout documents. Pages treats PDF files like all other image formats, so you can import them through the Insert menu.
Choose Tools, click on Edit PDF, then on Link, and finally, select Add/Edit Web or Document Link. Select the area that you want to hyperlink. Then, in the Create Link dialog box, choose the options you want for the link appearance and click on the Open a Web Page button for the link action. Hit Next and enter the link.
To embed the PDF in the HTML window, point the page to a document and then specify the height and width of the PDF so the HTML window is the correct size using the code: <embed src="filename. pdf" width="500" height="375">. Note that an embedded PDF may look very different on different browsers and operating systems.
You could consider using PDFObject by Philip Hutchison.
Alternatively, if you're looking for a non-Javascript solution, you could use markup like this:
<object data="myfile.pdf" type="application/pdf" width="100%" height="100%"> <p>Alternative text - include a link <a href="myfile.pdf">to the PDF!</a></p> </object>
PDF.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance. It is community-driven and supported by Mozilla Labs.
You can see the demo here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With