aspPDF.NET Sample Code

The following code example assumes that you are using the @import directive to reference the component from the GAC.  You can avoid this by simply downloading the trial version of the component and placing it in your /bin folder.

Online Documentation for aspPDF.NET can be found at:

C# Sample

// NOTE: The line below can be excluded if you reference the assembly in your web.config.
<%@ Assembly name="Persits.PDF, Version=, Culture=neutral, PublicKeyToken=b8d8c63f1ff142a8" %>

<%@ Import Namespace="Persits.PDF" %>

<script runat="server" language="c#">
void Page_Load(Object Source, EventArgs E)
    // create instance of the PDF manager
    PdfManager objPDF = new PdfManager();

    // Create new document
    PdfDocument objDoc = objPDF.CreateDocument();

    // Add a page to document
    PdfPage objPage = objDoc.Pages.Add();

    // Obtain font
    PdfFont objFont = objDoc.Fonts["Helvetica"];
    // Draw text
    objPage.Canvas.DrawText("Hello World!", "x=100; y=400; size=50", objFont);

    // Save to HTTP stream for instant viewing by user       
    objDoc.SaveHttp( "filename=test.pdf");

Add Feedback