PdfWebControlRenderControl Method (TextWriter) |
Namespace: RadPdf.Web.UI
using System.Web; using RadPdf.Web.UI; public class RadPdfSampleHandler : IHttpHandler { public RadPdfSampleHandler() { } public void ProcessRequest(HttpContext context) { //Get reference to Request and Response objects HttpRequest Request = context.Request; HttpResponse Response = context.Response; //Get PDF as byte array from file (or database, browser upload, remote storage, etc) byte[] pdfData = System.IO.File.ReadAllBytes(Server.MapPath(@"pdfs\RadPdfSampleForm.pdf")); //Create PdfWebControl instance PdfWebControl pdfWebControl1 = new PdfWebControl(); pdfWebControl1.ID = "PdfWebControl1"; //Open PDF document pdfWebControl1.CreateDocument(pdfData); //Start generate HTML Response.Write("<html>"); Response.Write("<head>"); Response.Write("<title>Example</title>"); //Insert PdfWebControl HEAD (max once per page) PdfWebControl.RenderHead(Response.Output); Response.Write("</head>"); Response.Write("<body>"); //Insert PdfWebControl HTML pdfWebControl1.RenderControl(Response.Output); Response.Write("</body>"); Response.Write("</html>"); } public bool IsReusable { // To enable pooling, return true here. // This keeps the handler in memory. get { return false; } } }