VPE DLL on Windows

<< Click to Display Table of Contents >>

Navigation:  Getting Started >

VPE DLL on Windows

Previous pageReturn to chapter overviewNext page

The following example is in C/C++, but can be easily translated to any other programming language. Write the following function and call it from an event-handler of your application, for example from an event-handler for a menu- or button-click:

void MakeDoc(HWND hWndParent)

{

 // hWndParent is the window handle of your application window

 VpeHandle hDoc = VpeOpenDoc(hWndParent, "Test", 0);

 VpeWriteBox(hDoc, 1, 1, 5, 1.5, "Hello World!");

 VpeLine(hDoc, 1.5, 3, 5, 6.5);

 VpeWriteDoc(hDoc, "hello world.pdf");

 VpePreviewDoc(hDoc, NULL, VPE_SHOW_NORMAL);

}

You must link your application against the VPE library. For example, in Visual Studio put the library into your solution. The library can be found in the installation directory of VPE, in the subdirectory "imp_libs" under the name "vpe<version>.lib".

Congratulations, this is your first program using VPE! The source code is self-explanatory, the only thing to explain are the numbers in the calls to WriteBox() and Line(): these are the coordinates in centimeters relative to the upper left corner of the page. The coordinates are organized as (left, top, right, bottom).

Note: you can also switch to inch units, so the coordinates are not in centimeters, but in inches.

Please note that this is a very very simple demo. For example, VPE can compute the width and height of a text object depending on the text-length and the chosen font. So you can position objects dynamically at runtime relative to each other, in contrast to a static layout.

We recommend to continue with the tutorial created by running the "vpedemo" executable, which comes with VPE. The demo named "Capabilities + Precision" creates a document with a handy 5-page tutorial (beginning on page 2 of the document).

The very detailed and in-depth explanation of all aspects and features of VPE can be found in this document in the chapter “Programming Techniques”.