title: Opening a PDF in browser instead of downloading it
body: <p>I'm using iTextSharp to print a panel into PDF on button click. After clicking on the button, the PDF is downloading to the client's computer. Instead of this I need the PDF to be opened in a browser instead of downloading. From the browser the user will be able to download the PDF to his PC.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>Response.ContentType = "application/pdf";
  Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".pdf");
  Response.Cache.SetCacheability(HttpCacheability.NoCache);
  StringWriter sw = new StringWriter();
  HtmlTextWriter hw = new HtmlTextWriter(sw);
  pnl_print.RenderControl(hw);
  
  StringReader sr = new StringReader(sw.ToString());
  Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
  HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
  PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
  pdfDoc.Open();
  htmlparser.Parse(sr);
  pdfDoc.Close();
  Response.Write(pdfDoc);
  Response.End();
  
  sr.Close();
  hw.Close();
  sw.Close();
  </code></pre>