title: 'The document has no page' error thrown when closing a document
body: <p>I'm generating, saving and writing PDF on output stream.</p>
  
  <p>I'm getting a <code>The document has no page</code> error while writing on output stream.</p>
  
  <p>What is the problem?</p>
  
  <pre><code>string contents;
  string fileName = "aaa.pdf";
  Response.ContentType = "application/pdf";
  Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
  Response.Cache.SetCacheability(HttpCacheability.NoCache);
  StringWriter sw = new StringWriter();
  HtmlTextWriter hw = new HtmlTextWriter(sw);
  hw.AddStyleAttribute("font-size","11px");
  abs.RenderControl(hw);
  string path = Server.MapPath("../Images/a.png");
  contents = sw.ToString();
  contents = contents.Replace("../Images/a.png", path);
  sw.Close();
  hw.Close();       
  StringReader sr = new StringReader(contents);
  
  System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/pdf/") + fileName, FileMode.Create);
  Document pdfDoc = new Document(PageSize.A4, 30,5,35,5);
  Document cpdfDoc = new Document(PageSize.A4, 30, 5, 35, 5);
  
  pdfDoc.PageCount = 2;
  cpdfDoc.PageCount = 2;
  HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
  PdfWriter.GetInstance(pdfDoc,fs);
  pdfDoc.Open();
  htmlparser.Parse(sr);
  pdfDoc.Close();
  fs.Close();
  HTMLWorker htmlparser2 = new HTMLWorker(cpdfDoc);               
  PdfWriter.GetInstance(cpdfDoc, Response.OutputStream);
  cpdfDoc.Open();
  htmlparser2.Parse(sr);
  
  cpdfDoc.Close();    
  
  Response.Write(cpdfDoc);
  Response.Flush();
  Response.End();
  </code></pre>
  
  <p>No problem in saving. I'm getting error on this line <code>cpdfDoc.Close();</code>.</p>