11

net mvc 3. I want to display the pdf file as a part of aspx page for preview purpose.enter image description here

i don't want to use IFrame control. can we do this ?

rick schott
  • 21,012
  • 5
  • 52
  • 81
Red Swan
  • 15,157
  • 43
  • 156
  • 238

1 Answers1

15

I know you said no frames, but Google PDF viewer seems to be the most popular:

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

And you can try:

<embed src="http://yoursite.com/the.pdf" width="500" height="375">

Best Way to Embed PDF in HTML

Community
  • 1
  • 1
rick schott
  • 21,012
  • 5
  • 52
  • 81
  • You beat me to it by literally 20 seconds. Damn! – Marko Oct 25 '11 at 03:49
  • google PDF is good way. but need privacy as per client policies. so it will better to keep the pdf file in my app domain in file structure and render them as part of the Page. niether to capture overall page or open in new tab. just user would like to click the preview and async call goes to pdf file to be render... thanks guys your directions are helpfull but need more focus on the privacy and policies. – Red Swan Oct 25 '11 at 05:56
  • Google iframe option needs the files to be publicly available that could be harmful for some scenarios. Any how, it works for me. – Jamshaid K. Jan 08 '19 at 20:51