title: iTextSharp - Generate PDF file - The remote server returned an error: (407) Proxy Authentication Required
body: <p>I am facing proxy authentication issue on my below code snipplet.</p>
  
  <pre><code>file = [FILEPATH]
  htmlData = [HTML CONTENTS]
  
  System.IO.StringReader objReader = default(System.IO.StringReader);
  Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
  HTMLWorker htmlparser = default(HTMLWorker);
  
  objReader = new System.IO.StringReader(htmlData);
  FileStream fsTest = new FileStream(file, FileMode.Create, FileAccess.ReadWrite);
  
  htmlparser = new HTMLWorker(pdfDoc);
  
  PdfWriter.GetInstance(pdfDoc, fsTest);
  
  pdfDoc.Open();
  htmlparser.Parse(objReader);
  pdfDoc.Close();
  </code></pre>
  
  <p>I am not sure weather it is iTextSharp issue or I need to do some authentication at code level?
  Please suggest.</p>
  
  <p>Detailed error:</p>
  
  <pre><code>The remote server returned an error: (407) Proxy Authentication Required. || System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required. at System.Net.HttpWebRequest.GetResponse() at iTextSharp.text.Image.GetInstance(Uri url) at iTextSharp.text.html.simpleparser.HTMLWorker.StartElement(String tag, Dictionary`2 h) at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Go(TextReader reader) at AppWeb.AssetActions.GeneratePDFFromHTML(String htmlData, String file) || at System.Net.HttpWebRequest.GetResponse() at iTextSharp.text.Image.GetInstance(Uri url) at iTextSharp.text.html.simpleparser.HTMLWorker.StartElement(String tag, Dictionary`2 h) at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Go(TextReader reader) at.
  </code></pre>