HOME DOCUMENTATION DOWNLOADS BLOG

Forcing PDF Reports To Be Downloaded

In case you need to have your PDF reports downloaded instead of directly opened in browser you can do so via Startup.cs.

Add following snippet to Configuration method inside of Startup.cs:

app.Use((context, next) => {
    context.Response.OnSendingHeaders(o => {
        if(context.Response.ContentType == "application/pdf") {
            if(context.Response.Headers.ContainsKey("content-disposition")) {
                 context.Response.Headers["content-disposition"] 
                            = "attachment; " + context.Response.Headers["content-disposition"];
                 } else {
                     context.Response.Headers["content-disposition"] = "attachment; ";
                 }
            }
        }, null);
    return next.Invoke();
});

Preferably before this row:

AsapEngine.ConnectRuntime();

This configuration is supported by Flash client with suppressReportTabs setting. See: https://origam.com/doc/display/architect/web.config+Configuration