-1

I am beginner of web programming, my question is how to embed pdf document in html one division tag, and that pdf we can avoid copy, print and download options.

this following is my code.

<html>
  <head>
    <title>Pdf Document
    </title>
  </head>
  <body>
    hello world!
      <br>
        <div width="500px" height="500px">

          <embed src="myfile.pdf#toolbar=0&navpanes=0&scrollbar=0" width="425" 

            height="425">
          </div>
          <div width="1px"> hello</div>
        </body>
      </html>
ymn
  • 2,175
  • 2
  • 21
  • 39
vikram
  • 42
  • 1
  • 7

1 Answers1

1

Some option may be help you:

First:

If you do stick with the pdf embedded option, Pdf files don't look so great on a webpage. Anyway, be sure to be strict about the coding. Hence:

<iframe src="path/to/pdf" width=500 height = 500>

Should be

<iframe src="path/to/pdf" width="500" height="500">

Second:

You can also use Google PDF viewer for this purpose.

You need to upload your PDF somewhere before and just use its URL:

<iframe src="http://docs.google.com/gview?url=http://example.com/mypdf.pdf&embedded=true"  style="width:500px; height:500px;" frameborder="0"></iframe>

Third:

Best approach is to use the PDF.JS library. It's a pure HTML5/JavaScript renderer for PDF documents without any third-party plugins.

Online demo: http://mozilla.github.com/pdf.js/web/viewer.html

GitHub: https://github.com/mozilla/pdf.js

Links:

Recommended way to embed PDF in HTML?

How to embed a PDF file in a web site?

Community
  • 1
  • 1
Vishal Bharti
  • 185
  • 1
  • 9