Monday, 19 August 2013

Opening PDF Files in Browser

Embedding a PDF using HTML markup

Click here to learn about embedding a PDF using JavaScript
Embedding a PDF using the standards-compliant <object> element is actually rather simple, and looks like this:
<object data="myfile.pdf" type="application/pdf" width="100%"
 height="100%">
 
  <p>It appears you don't have a PDF plugin for this browser.
  No biggie... you can <a href="myfile.pdf">click here to
  download the PDF file.</a></p>
  
</object>
Note the <p> nested inside the <object>; this content will be displayed if the browser isn't capable of displaying the <object>. In this example, the 'fallback' content contains a link to the PDF, which allows visitors who don't have the Adobe Reader plugin to download the PDF and view it offline.

PDF Open Parameters

Adobe Reader provides a number of PDF open parameters that allow you to control how a PDF file is displayed when opened. Options include zoom level, jumping to a page number, highlighting search terms, and selecting which toolbars will be visible. Read more about PDF open parameters here.

Not comfortable writing your own code?

Use the code generator. Simply fill out the form and the generator will provide you with standards-compliant markup you can copy and paste into your HTML file. The code generator can also automatically generate the PDF open parameter code for you. It's really convenient, and completely free! Click here to use the generator.

No comments:

Post a Comment