Click or drag to resize

Introduction to ExpertPdf PDF Creator Library for .NET

The ExpertPdf PDF Creator for .NET consists in a .NET assembly epdfcreator.dll that can be referenced directly in any .NET application (ASP.NET, Windows Forms, Console, Web Services, Windows Services, etc) to create PDF documents from the scratch or modify existing PDF documents. The second dll needed by our component, epengine.dll will be automatically copied to your bin folder.

The PDF SDK component also offers a very powerful integrated HTML to PDF converter which fully supports HTML tags and CSS styles and an integrated RTF to PDF converter. Using the built-in converters you can easily create complex PDF documents from your HTML and RTF documents that you can further customize by adding texts, images, security features and interactive elements like bookmarks, links, attachments or text notes.

The product does not require any installation and it does not use any printer driver to perform conversion from HTML and RTF to PDF. It's just an assembly that you can directly link with your .NET application and is using only Microsoft technologies and tools.

The programming interface is object oriented, has a clear design, is extremely easy to understand and use.

Code Sample

Here is a simple code sample that shows how easy it is to use the Pdf Creator:

protected void btnConvert_Click(object sender, EventArgs e)
{
    //create a PDF document
    Document document = new Document();

    //optional settings for the PDF document like margins,compression level,
    //security options, viewer preferences, document information, etc
    document.CompressionLevel = CompressionLevel.NormalCompression;
    document.Margins = new Margins(10, 10, 0, 0);
    document.Security.CanPrint = true;
    document.Security.UserPassword = "";
    document.DocumentInformation.Author = "HTML to PDF Converter";
    document.ViewerPreferences.HideToolbar = false;

    //Add a first page to the document.
    PdfPage page = document.Pages.AddNewPage(PageSize.A4, new Margins(10, 10, 0, 0), PageOrientation.Portrait);

    // add a font to the document that can be used for the text elements 
    PdfFont font = document.Fonts.Add(new System.Drawing.Font(
                new System.Drawing.FontFamily("Times New Roman"), 10,
                System.Drawing.GraphicsUnit.Point));

    // convert HTML to PDF
    HtmlToPdfElement htmlToPdfElement = new HtmlToPdfElement(xLocation, yLocation, width, height, urlToConvert);

    //optional settings for the HTML to PDF converter
    htmlToPdfElement.FitWidth = cbFitWidth.Checked;
    htmlToPdfElement.EmbedFonts = cbEmbedFonts.Checked;
    htmlToPdfElement.LiveUrlsEnabled = cbLiveLinks.Checked;
    htmlToPdfElement.RightToLeftEnabled = cbRTL.Checked;
    htmlToPdfElement.ScriptsEnabled = cbClientScripts.Checked;
    htmlToPdfElement.ActiveXEnabled = cbActiveXEnabled.Checked;

    // add the HTML to PDF converter element to page
    addResult = page.AddElement(htmlToPdfElement);

    // send the generated PDF document to client browser
    document.Save(Response, false, "HtmlConvert.pdf");
}
See Also

Other Resources