HTML2PDF-X Pilot – Sample Usage from .NET application


Home       Download       Samples       Tutorials       Pricing       FAQ       History

 

This page provides example code to help you use the HTML2PDF-X Pilot library from .NET client application. We strongly advise you to read this tutorial to better understand how interoperability between COM and .NET works. To use HTML2PDF-X Pilot, first you should install the library on your computer. After creation of a .NET client application project, you should add a reference to the registered COM object (Click Project, then Add Reference. Ensure that the COM tab is selected) to the .NET assembly. Now your application is ready to use the methods and properties of HTML2PDF-X library.

Download the full project for MS Visual Studio 2010.

using System;
using System.Collections.Generic;
using System.Text;
using html2pdfxLib;
 
namespace AxClient_dotNet
 
{
    class Program 
    {
        static void Main(string[] args)
        {
             // Create an instance of the main class of the library 
            IHTML2PDFX html2pdf_obj;
            html2pdf_obj = new HTML2PDFX();
 
            // Start using library:
            html2pdf_obj.StartHTMLEngine("demo", "demo");
            html2pdf_obj.SlicingMode = false;
 
            html2pdf_obj.BeginDoc();
            html2pdf_obj.BaseURL = "https://www.colorpilot.com";
            html2pdf_obj.LoadURL("https://www.colorpilot.com");
            html2pdf_obj.ContentZoomFactor = 80;
            html2pdf_obj.ConvertAll();
            html2pdf_obj.DrawText(450, 200, 300, 40, "alingcenter", "Sample Text", 1, 1, 0);
            html2pdf_obj.EndDoc();
        }
    }
}

 

Download the full project for MS Visual Studio 2010.

 


Home       Download       Samples       Tutorials       Pricing       FAQ       History