2

I have a pdf file named 102.pdf in my App_Data folder. I want to view this in my web browser like chrome.Here is my code. But I can not display it.

<iframe src="102.pdf" width="400" height="400"></iframe>

I am using VS11

Any help would be appreciated. Thanks in advance

4
  • 2
    Don't you need to specify the App_Data folder? src="<%=ResolveUrl("~/App_Data/102.pdf")%>" Commented May 29, 2012 at 12:05
  • 1
    As far as I know you will have to have an application installed that can actually do something with the pdf. Like Adobe Acrobat Reader or some sort of web browser extension. The web browser will only (maybe) display the pdf if the file association is supported on the operating system. Commented May 29, 2012 at 12:06
  • I have Adobe reader installed. I am wondering this code works fine in php. But its not working on MVC3 @Tomas Commented May 29, 2012 at 12:08
  • @ChrisGessler I am usign razor engine. Commented May 29, 2012 at 12:10

2 Answers 2

1

You can try something like this : http://forums.asp.net/t/1506499.aspx/1?Dynamic+pdf+generation+using+iTextSharp

And is it a requirement to render pdf? what you can do is produce a markup of the same pdf file in browser and make it available for download in pdf using lib like itext http://itextpdf.com/.

Sign up to request clarification or add additional context in comments.

3 Comments

Think that he just wants to have an existing pdf appear in an iframe
Ok I do not want to generate pdf :) But I have already have a pdf and I want to display it on my webpage.
<embed src="102.pdf #toolbar=1&navpanes=0&scrollbar=1" width="1000" height="1000"> This portion of code workes fine in php except asp.net MVC3 razor engine
1

`

<iframe src="@Url.Content("~/Content/pdfs/102.pdf")" width="1000" height="500"></iframe>

`

Its the solution for how to view a pdf file in asp.net MVC3 with razor engine.

Happy coding :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.