VPE Control (.NET / ActiveX / VCL)

<< Click to Display Table of Contents >>

Navigation:  Getting Started >

VPE Control (.NET / ActiveX / VCL)

Previous pageReturn to chapter overviewNext page

Place a VPE component onto a form and change its name to "Doc".

Place a button onto the form. In the OnClick() handler of the button, insert the following code:

Doc.OpenDoc()

Doc.WriteBox(1, 1, 5, 1.5, "Hello World!")

Doc.Line(1.5, 3, 5, 6.5)

Doc.WriteDoc("hello world.pdf")

Doc.Preview()

Congratulations, this is your first program using VPE! Depending on the programming language you are using, you must add semicolons ";" at the end of each line, or leave out the empty parentheses "( )".

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”.