Click or drag to resize

PdfWebControlLiteRenderHead Method (TextWriter)

Renders the PdfWebControlLite required HTML HEAD elements (e.g. script, style, etc.) to the specified text writer, for use in advanced applications such as a Custom HttpHandler or ASP.NET MVC view rendering.

Namespace:  RadPdf.Web.UI
Assembly:  RadPdf (in RadPdf.dll) Version: 3.48.0.0 (3.48.0.0)
Syntax
public static void RenderHead(
	TextWriter writer
)

Parameters

writer
Type: System.IOTextWriter
The TextWriter object that receives the HTML HEAD child elements.
Remarks

This method does not conisder any value assigned to BasePath.

Examples
The following code example demonstrates the rendering of a PdfWebControlLite instance to a HttpHandler's Response object.
C#
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 PdfWebControlLite instance
        PdfWebControlLite PdfWebControlLite1 = new PdfWebControlLite();
        PdfWebControlLite1.ID = "PdfWebControlLite1";

        //Open PDF document
        PdfWebControlLite1.CreateDocument(pdfData);

        //Start generate HTML
        Response.Write("<html>");
        Response.Write("<head>");
        Response.Write("<title>Example</title>");

        //Insert PdfWebControlLite HEAD (max once per page)
        PdfWebControlLite.RenderHead(Response.Output);

        Response.Write("</head>");
        Response.Write("<body>");

        //Insert PdfWebControlLite HTML
        PdfWebControlLite1.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; }
    }
}
See Also