0

I need to display a PDF file in a div.
Here is what I have done so far.

<object data="D:\Report\428997.pdf" type='application/pdf' style='width: 100%; height: 700px'>
     <embed src='D:\Report\428997.pdf' type='application/pdf' style='width: 100%; height: 700px; border:0;' />
</object>

But, I am getting a blank gray color instead of the PDF.
I also tried changing the settings of Chrome to preview PDF.

Can anyone point me what I am doing wrong?

Tony
  • 11
  • 1

1 Answers1

0

Lots of assumptions must be made, so I'm assuming either:

  1. You're developing locally since you're using local file URLs D:\Report… . If so, I would strongly recommend setting up a WAMP stack so that you have a localhost setup and then make sure that the PDF you're testing is in the proper localhost (local server) path. Then you can definitively test whether it's a path issue. Alternatively, I can assume…

  2. That you already have a WAMP-like/localhost setup in place, in which case the problem is that you're trying to access your local filesystem (D:\…) from it.

In either case, pointing to your local drive from within your html and not a server (or virtual server) path is likely contributing to your headaches.

I'm assuming that you already know that your browser can open PDFs, and that your problem in particular is with this isolated code and not all PDFs.

dashard
  • 877
  • 1
  • 10
  • 17