diff --git a/Rotativa/AsPdfResultBase.cs b/Rotativa/AsPdfResultBase.cs
index 3a88664..a9e6d6c 100644
--- a/Rotativa/AsPdfResultBase.cs
+++ b/Rotativa/AsPdfResultBase.cs
@@ -37,6 +37,11 @@ public string CookieName
set { FormsAuthenticationCookieName = value; }
}
+ ///
+ /// This will be send to the browser as the content disposition telling it how to return the document
+ ///
+ public ContentDisposition ContentDisposition { get; set; }
+
///
/// Custom name of authentication cookie used by forms authentication.
///
@@ -277,8 +282,10 @@ protected HttpResponseBase PrepareResponse(HttpResponseBase response)
{
response.ContentType = ContentType;
+ string contentDisposition = ContentDisposition == ContentDisposition.Inline ? "inline" : "attachment";
+
if (!String.IsNullOrEmpty(FileName))
- response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", SanitizeFileName(FileName)));
+ response.AddHeader("Content-Disposition", string.Format("{0}; filename=\"{1}\"", contentDisposition, SanitizeFileName(FileName)));
response.AddHeader("Content-Type", ContentType);
diff --git a/Rotativa/Options/Enums.cs b/Rotativa/Options/Enums.cs
index 4299c72..705b244 100644
--- a/Rotativa/Options/Enums.cs
+++ b/Rotativa/Options/Enums.cs
@@ -165,4 +165,10 @@ public enum Orientation
Landscape,
Portrait
}
+
+ public enum ContentDisposition
+ {
+ Attachment,
+ Inline
+ }
}