title: Exporting webpage as PDF
body: <p>I'm trying to export a PDF from an asp.net webpage that has a master site. Please note that I am not using a grid view, I just want to export the page itself. </p>
  
  <p>Here is what I currently have: </p>
  
  <pre><code>Response.ContentType = "application/pdf"
  Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf")
  Response.Cache.SetCacheability(HttpCacheability.NoCache)
  Dim sw As New StringWriter()
  Dim hw As New HtmlTextWriter(sw)
  Me.Page.RenderControl(hw)
  Dim sr As New StringReader(sw.ToString())
  Dim pdfDoc As New iTextSharp.text.Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)
  Dim htmlparser As New HTMLWorker(pdfDoc)
  PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
  pdfDoc.Open()
  htmlparser.Parse(sr)
  pdfDoc.Close()
  Response.Write(pdfDoc)
  Response.[End]()
  </code></pre>
  
  <p>The errors message I'm getting is:</p>
  
  <p>The UNC path should be of the form \server\share.</p>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.ArgumentException: The UNC path should be of the form \server\share.</p>
  
  <pre><code>Source Error: 
  
  
  Line 46:             PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
  Line 47:             pdfDoc.Open()
  Line 48:             htmlparser.Parse(sr)
  Line 49:             pdfDoc.Close()
  Line 50:             Response.Write(pdfDoc)
  </code></pre>
  
  <p>Any help would be great, thanks. </p>