Components for Developers
© 2000-2017, Two Pilots

PDF Library   EMF2PDF SDK Pilot   Virtual Printers   HTML2PDF-X Pilot   Converters   PDF Mosaic  
Home Download Samples Tutorials Pricing FAQ History

HTML2PDF-X Pilot

 

Sample Usage from Visual C++

 

This page provides an example code which will help you to use HTML2PDF-X Pilot library from MS Visual C++.

Download the full project for MS Visual Studio 2010

// AxClient_cpp.cpp : Defines the entry point for the console application.
//  

#include "stdafx.h"
#include "windows.h"

// Set the path to the "html2pdfx.dll" file:
#import "c:\Program Files\HTML2PDF-X Pilot\html2pdfx.dll"

using namespace html2pdfxLib;

int _tmain(int argc, _TCHAR* argv[])
{ 
// Initializes the thread for apartment-threaded object concurrency: CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); // Pointer to the object with IHTML2PDFX interface: IHTML2PDFX *html2pdf_obj; // GUID for HTML2PDF-X server: CLSID html2pdf_clsid; // Get CLSID for HTML2PDF-X COM/ActiveX server: HRESULT hr = CLSIDFromProgID(OLESTR("html2pdfx.HTML2PDFX"), &html2pdf_clsid); // Initialize instance of COM object: if (SUCCEEDED(hr)) hr = CoCreateInstance(html2pdf_clsid, NULL, CLSCTX_ALL, __uuidof(IHTML2PDFX), (LPVOID*)&html2pdf_obj); // Error handler: if (FAILED(hr) || !html2pdf_obj) { MessageBox(NULL, L"Cannot create HTML2PDFX object!" , L"Error" , MB_OK); return 1; } // Accessing to HTML2PDF-X object methods and properties: html2pdf_obj->StartHTMLEngine(L"demo" , L"demo" ); html2pdf_obj->SlicingMode = false; html2pdf_obj->BeginDoc(); html2pdf_obj->BaseURL = L"http://www.colorpilot.com"; html2pdf_obj->LoadURL(L"http://www.colorpilot.com"); html2pdf_obj->ContentZoomFactor = 80; html2pdf_obj->ConvertAll(); html2pdf_obj->DrawText(450, 200, 300, 40, L"alingcenter", L"Sample Text", 1, 1, 0); html2pdf_obj->EndDoc(); // Release HTML2PDF-X instance: html2pdf_obj->Release(); return 0;
}

 

Download the full project for MS Visual Studio 2010

HTML2PDF-X Pilot main page

Home Download Samples Tutorials Pricing FAQ History

 

PDF Library | EMF2PDF SDK Pilot | Virtual Printers
HTML2PDF-X Pilot | Converters | PDF Mosaic

Support | Blog
Contact | About | Site map

© 2000-2017, Two Pilots