title: How do I intercept the output stream of the current actionresult in .NET MVC3?
body: <p>Hi and thanks for looking!</p>
  <h2>Background</h2>
  <p>I am using the <a href="https://github.com/webgio/Rotativa" rel="nofollow noreferrer">Rotativa</a> pdf tool to read a view (html) into a PDF.  It works great, but it does not natively offer a way to save the PDF to a file system.  Rather, it only returns the file to the user's browser as a result of the action.</p>
  <p>Here is what that code looks like:</p>
  <pre><code>public ActionResult PrintQuote(FormCollection fc)
          {
              int revisionId = Int32.Parse(Request.QueryString[&quot;RevisionId&quot;]);
  
              var pdf = new ActionAsPdf(
                   &quot;Quote&quot;,
                   new { revisionId = revisionId })
                         {
                             FileName = &quot;Quote--&quot; + revisionId.ToString() + &quot;.pdf&quot;,
                             PageSize = Rotativa.Options.Size.Letter
                         };
  
              return pdf;
  
          } 
  </code></pre>
  <p>This code is calling up another actionresult (&quot;Quote&quot;), converting it's view to a PDF, and then returning the PDF as a file download to the user.</p>
  <h2>Question</h2>
  <p>How do I intercept the file stream and save the PDF to my file system.  It is perfect that the PDF is sent to the user, but my client also wants the PDF saved to the file system simultaneously.</p>
  <p>Any ideas?</p>
  <p>Thanks!</p>
  <p>Matt</p>