0

What I try to achieve:

Convert a MVC3 view to PDF with abcpdf 8.

It is a result view where I want to cut off party of the views DOM like navigation and other website related parts.

Abcpdf needs, in order to render the html with all css formattings correctly, a absolute url. But I don't want to show the result-pdf view to the user. So how can I access a view from controller by URL without displaying the view. The original result view shall be displayed all the time.

Thank you in advance Christian

csteinmueller
  • 2,427
  • 1
  • 21
  • 32

1 Answers1

2

You cannot access a View directly with MVC, you have to go through a Controller method. In ASP.NET MVC, URLs map to Controller methods, not to Views.

So if you know the URL of the Controller method that calls the View, you can take that URL and pass it to ABCPDF.

Roy Dictus
  • 32,551
  • 8
  • 60
  • 76
  • If I do it that way, the Model of the ResultDownload view is always null. I'm working with TempData["result"], but the TempData is null, even if I use Keep("result") or rewrite the TempData before passing the url to abcpdf. – csteinmueller Jan 21 '13 at 10:56
  • Why don't you pass the model to the View explicitly? – Roy Dictus Jan 21 '13 at 11:39