wPDFControl DLL / ActiveX

[Top]  [Chapter]  [Previous]  [Next]

Principle of PDF Creation


To use PDFControl in your application you first have to load the DLL an initialize it.


We have create a header file which makes it easy to do this in C and also provide a C++ class which does most of the tasks automatically. If you use the interface ActiveX you need to add one instance of it to your form and use the provided functions. Don't worry about header files.


First you need to initialize the DLL using Initialize or InitializeEx.


After you have initialized the DLL you can execute the function BeginDoc to start the output. When you are done you execute EndDoc to finalize and close the PDF file.


While the PDF file is open you can create a new page with StartPage. The page has to be closed with EndPage. While a page is active you can use the HDC (Device handle) of the PDF engine to create the output.


You can retrieve this handle with the function DC and use it with regular GDI drawing routines.

There are also some functions which make it easier to change the font, and the background and pen colors. If you use these functions the DC will be changes as if you would use the windows API - but they are much easier to use and you don't have to worry about HFONT, HBRUSH and HPEN GDI resources.


The PDF Engine includes a method called ExecCommand. This method is used by the RTF2PDF library as an interface to the integrated RTF-engine. Different command codes are used to select the intern functions.



Example C code: (uses wpdf.h. Use the macro 'LOAD_WPDF_ENGINE(dll_handle,dll_name)' to load the DLL and initialize the function pointers)


int dll;

if(LOAD_WPDF_ENGINE(dll, "wpdfcontrol02.dll" )=0)


  pdf = wpdfInitialize();

  if( wpdfBeginDoc(pdf,"test.pdf",0))



 TextOut (wpdfDC(pdf), 72, 72, "Hello World", 11);







Example C++Code: (uses wPDF_Class.cpp)









    Ellipse(cexp->DC(), 10,100,300,300);


  } // if(cexp.BeginDoc(PdfFileName,0))






[wpdfcontrol_dll.htm]    Copyright © 2007 by WPCubed GmbH