Created
October 8, 2009 13:06
-
-
Save mhinze/205003 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseReportPage<TModel> : BaseViewPage<TModel>, IViewBase where TModel : class | |
{ | |
// ... | |
protected override void OnPreInit(EventArgs e) | |
{ | |
if (ShowAsPdf) | |
{ | |
string path = _configuration.GetPrincePath(); | |
var prince = new Prince(path); | |
prince.SetBaseURL(Request.Url.AbsoluteUri); | |
prince.AddStyleSheet(Server.MapPath("~/css/Styles.css")); | |
prince.AddStyleSheet(Server.MapPath("~/css/ReportModules/Redefinitions.css")); | |
prince.SetLog("prince.log"); | |
Response.Clear(); | |
Response.Filter = new PrinceFilter(prince, Response.Filter); | |
Response.AddHeader("Content-Type", "binary/octet-stream"); | |
Response.AddHeader("Content-Disposition", "attachment; filename=Report.pdf;"); | |
} | |
base.OnPreInit(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment