title: ASP.NET Compiler errors with iTextSharp xmlworkerhelper
body: <p>I'm trying to write an application that will fire off a series of web reports that I've built in ASP.NET. So I have a web application where the pages live, but I don't really want to use the website to see the pages, I want to create PDFs that I can deliver to my clients. </p>
  
  <p>The application I'm trying to write is a console app, written in Visual Studio 2010 in c# and using iTextSharp v5.5.2 and .NET 4.5. It's currently just a framework as I haven't got to the "firing off PDFs" part yet. I'm accessing a page from the web and trying to save it as a PDF, but I can't find any info on the compile errors I'm getting. I have the following Using directives in the application:</p>
  
  <pre><code>using iTextSharp;
  using iTextSharp.text;
  using iTextSharp.text.pdf;
  using iTextSharp.text.html;
  using iTextSharp.text.xml;
  using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Net;
  using System.Text;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Xml;
  using iTextSharp.text.io;
  using iTextSharp.text.xml.simpleparser;
  using iTextSharp.text.html.simpleparser;
  
  namespace ConsoleApplication1
  {
      public partial class BuildReports : System.Web.UI.Page
      {
          static void Main(string[] args)
          {
              WebRequest wReq = WebRequest.Create("http://www.somesite.com/");
              WebResponse wRsp = null;
  
              try
              {
                  wRsp = wReq.GetResponse();
              }
              catch (Exception e)
              {
                  Console.WriteLine("{0} exception caught.", e);
              }
  
              Console.WriteLine(((HttpWebResponse)wRsp).StatusDescription);
              Stream sRsp = wRsp.GetResponseStream();
              StreamReader sRdr = new StreamReader(sRsp);
              string sHtml = string.Empty;
              sHtml = sRdr.ReadToEnd();
              Console.WriteLine(sHtml);
              StringReader sr = new StringReader(sHtml);
              Document doc = new Document();
  </code></pre>
  
  <p>// The following lines are indicating that I need a Using directive or a Reference on the 
  // XmlWorkerHelper and XmlWorker declarations. What references are needed??</p>
  
  <pre><code>            XmlWorkerHelper.GetInstance(doc, new FileStream("test.pdf", FileMode.Create));
              XmlWorker obj = new XmlWorker(doc);
  </code></pre>
  
  <p>//---------------------------------------------------------------------------------------</p>
  
  <pre><code>            doc.Open();
              obj..Parse(sr);
              doc.Close();
              sRdr.Close();
              sRsp.Close();
          }
      }
      public class CustomHTTPModule : IHttpModule
      {
          public CustomHTTPModule()
          {
              // Class constructor.
          }
  
          // Classes that inherit IHttpModule  
          // must implement the Init and Dispose methods. 
          public void Init(HttpApplication app)
          {
  
              app.AcquireRequestState += new EventHandler(app_AcquireRequestState);
              app.PostAcquireRequestState += new EventHandler(app_PostAcquireRequestState);
          }
  
          public void Dispose()
          {
              // Add code to clean up the 
              // instance variables of a module.
          }
  
          // Define a custom AcquireRequestState event handler. 
          public void app_AcquireRequestState(object o, EventArgs ea)
          {
              HttpApplication httpApp = (HttpApplication)o;
              HttpContext ctx = HttpContext.Current;
              ctx.Response.Write(" Executing AcquireRequestState ");
          }
  
          // Define a custom PostAcquireRequestState event handler. 
          public void app_PostAcquireRequestState(object o, EventArgs ea)
          {
              HttpApplication httpApp = (HttpApplication)o;
              HttpContext ctx = HttpContext.Current;
              ctx.Response.Write(" Executing PostAcquireRequestState ");
          }
  
      }
  }
  </code></pre>
  
  <p>My questions:<br>
  1. What reference or Using directive do I need to resolve the compile errors on the XmlWorkerHelper and XmlWorker declarations?<br>
  2. Is there something else I'm missing that's causing the compile errors?<br>
  3. My reports are mainly composed of graphical elements. Will iTextSharp be able to produce the PDFs without a lot of manipulations?</p>
  
  <p>Thanks...</p>