Call html to pdf .net Library from a C++ Native Windows Application

Using the HiQPDF [link=]html to pdf[/link] conversion engine you can easily design a document in HTML with CSS3, JavaScript, SVG or Canvas and then convert it to PDF preserving the exact content and style.

HiQPdf library is a powerful and precise .NET library that you can call from a C++ Native Windows Application.

First you should register the HiQPdf classes for COM clients and produce a type library file by executing the following command in an Administrator command prompt:

regasm HiQPdf.dll /tlb:HiQPdf.tlb

The HiQPdf.tlb will be included in the C++ application code to offer the prototypes for HiQPdf classes and methods. The compiler will produce a C++ header file named HiQPdf.tlh from the TLB file, containing the HiQPdf library types and methods prototypes.

The HiQPdf.dll and HiQPdf.dep files must be copied near the application executable or otherwise you have to install the HiQPdf.dll in GAC to make it available for COM infrastructure. The C++ code of a simple console application which converts an URL and saves the resulted PDF document to a file on disk looks like below:



#import "HiQPdf.tlb" raw_interfaces_only

using namespace HiQPdf;

int main()




// create the HTML to PDF converter

_HtmlToPdfPtr htmlToPdfConverter(__uuidof(HtmlToPdf));

// get a reference to the PDF document control object from converter

_PdfDocumentControl * pdfDocumentControl;


// set PDF page orientation


// set PDF page margins

_PdfMargins* pdfMargins;






// create the URL to convert and output PDF file name strings

BSTR urlToConvert = SysAllocString(L"enter here theURL address");

BSTR outPdfFile = SysAllocString(L"out.pdf");

// call the converter to convert the HTML document to a PDF file

htmlToPdfConverter->ConvertUrlToFile(urlToConvert, outPdfFile);

// free the allocated strings





return 0;


The HTML to PDF, HTML to SVG and HTML to Image converters included in the HiQPdf library for .NET can be used to create high quality PDF documents, SVG vector images and transparent PNG images.

You can download the [link=]html to pdf[/link] demo applications for HiQPDF Library with source code in C# and VB


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!