// --------------------------------------------------------------------------- public void Write(Stream stream) { PdfServlet x = new PdfServlet(); x.WebContext = HttpContext.Current; if (x.WebContext != null) { HttpRequest Request = x.WebContext.Request; // Get the text that will be added to the PDF string text = Request["text"]; if (text != null && text.Trim().Length > 0) { x.SendPdf(stream, text); } else { x.SendHtml(); } } else { x.SendCommandLine(stream); } }