Red Swan
Red Swan

Reputation: 15553

display pdf in mvc 3 resides on azure server. Which is best way?

I am using Asp.net mvc3 and displaying the .pdf file on my one of page. according to architecture: Asp.net mvc3 + WCF+EF 4.1 with Azure web role+sql azure. My pdf file generated dynamically on cloud (azure). I need to display it on my aspx page using tag. but what should be the url need to provide to it? will this work with Azure ? or i need to download / save it dynamically in application domain temprary to assign url. which is best way?

Upvotes: 0

Views: 819

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039438

You could write a controller action which will dynamically generate the PDF file:

public ActionResult Pdf()
{
    byte[] pdf = ... generate the pdf dynamically here
    return File(pdf, "application/pdf");
}

and in the view:

<iframe src="<%= Url.Action("pdf", "somecontroller") %>" />

or if you know the url of the PDF on the cloud you can directly point the src of the iframe to it.

Upvotes: 2

Related Questions