Rank: Member Groups: Member
Joined: 8/27/2013 Posts: 11
|
Hi,
I am using:
MVCToPDF.ResultFileName = filename; MVCToPDF.RenderAsPDF();
I do not want to return the whole page though, does this mean I need to use HtmlToPdf instead?
Thanks, Kevin
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You can use HtmlToPdf directly but you do not have to. The idea of MVCToPDF is to capture whatever your page output is and turn it into PDF. So if you can add some code to hide certain section of your page before calling RenderAsPDF, those will not visible. The basic rule is, try to do whatever you would do if you were to produce the same output in your browser --- then add calls to RenderAsPDF to redirect that output to a PDF file.
Thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I believe you can also use VisibleElementIds. You can just set it before calling RenderAsPDF. Internally RenderAsPDF calls HtmlToPdf.ConvertHtml. So almost all HTML to PDF options can be used with MVCToPDF.
Thanks!
|