0% found this document useful (0 votes)
16 views79 pages

wxPdfCOM PDF Generation Manual

This document provides an introduction to the wxPdfCOM component, which allows generating PDF files from wxWidgets. It explains that wxPdfCOM wrapped the wxPdfDocument engine to expose its interface to other languages such as Visual Basic. It also describes the related libraries FPDF and wxWidgets, as well as the features and advantages of wxPdfCOM for generating PDF documents compared to other technologies.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views79 pages

wxPdfCOM PDF Generation Manual

This document provides an introduction to the wxPdfCOM component, which allows generating PDF files from wxWidgets. It explains that wxPdfCOM wrapped the wxPdfDocument engine to expose its interface to other languages such as Visual Basic. It also describes the related libraries FPDF and wxWidgets, as well as the features and advantages of wxPdfCOM for generating PDF documents compared to other technologies.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

J. Sánchez. wxPdfCOM.

Reference Manual

Creation of PDF files with :

Reference manual

1
J. Sánchez. wxPdfCOM. Reference Manual

Introduction

WxPdfCOM is a PDF document generation component based on wxWidgets. It


It is about an acronym. The prefix wx means that the component is based on the library.
open source wxWidgets. PDF is the well-known acronym for Adobe's Portable format
Document Format. And finally COM, it is the acronym for Microsoft that represents the
Component Object Model technology.

A COM object is essentially a dynamic link library (DLL) with the capability to
expose its user interface to other programs. Once the component is referenced in a
Visual Basic project, the PDF document is converted into another object of the language.
in the same way as the Printer or App objects.

The COM object is nothing more than a wrapper for the true generator engine of the
PDF documents, which is none other than wxPdfDocument. wxPdfDocument is code
open, just like wxWidgets and in turn is a translation of the also free FPDF.

In case so many names introduce any confusion for the reader, in the following
we will address each of them in detail so that they become more useful to us
relatives.

FPDF

FPDF is a class written in PHP that allows the generation of PDF documents directly, without
use no external library. The F in FPDF stands for Free (free and open): it can be used
for any purpose and to modify it to suit one's own needs.

Below we present a list of the main features of FPDF:

• Selection of the unit of measurement, page format, and margins


• Management of headers and footers
• Automatic page break
• Automatic line break and text justification
• Admission of images (JPEG and PNG)
• Colors
• Links
• Admission of TrueType, Type1 fonts and encoding
• Page compression

You can find everything related to FPDF on the internet (how could you not?). The address is
[Link] There you can find the source code of the class in question, a manual.
with all the commands, usage examples, and a section of scripts created by
Collaborators that in some cases only serve to further extend the initial capacity.
from the original class.

2
J. Sánchez. wxPdfCOM. Reference Manual

To use FPDF you only need an Internet server with PHP installed, your web pages.
they can contain PHP code to generate PDF documents and save them in a
file or send them directly to a browser. Since FPDF is free, anyone
puede tomar su código y modificarlo o copiarlo. Muchos ya lo han hecho. Gracias a esto
There are versions of FPDF in other languages, namely: ASP, Lingo, Python, Ruby, C++.

By the way, the C++ version is called wxPdfDocument and we will talk about it soon, but
First we will talk about wxWidgets.

wxWidgets

wxWidgets allows developers to create their applications for OS X, Windows,


Macintosh, GTK+ X11, Motif, WinCe and other operating systems, using the same
base code. It can be used from languages such as C++, Python, Perl, and C#.NET. It is
extensible, free and open, mature open source. You can't ask for more. All this
It means that you can have versions of your programs for different systems.
operational by just changing some options and recompiling. At the moment of
creating this manual wxWidgets is at version 2.8.4 and there are numerous programs
commercials that have been created based on this.

The website address is [Link] There, dear reader, you will be able to
delve into this formidable tool that others have chosen to share. As you will see
it's a whole world, wxForum, wxWiki, wxCommunity, wxBlog, wxCode. Everything is wx and everything
it's free. Although you can always make a donation or choose to collaborate. By the way
from wxCode...

wxCode

One of the places worth knowing within the world of wxWidgets is


this. [Link] There you will find programs, utilities, and components to make
your life as a wxProgrammer much easier and more enjoyable. That said, nothing is compiled, everything
It goes in source code. Isn't it wonderful? By the way, that's where you can find
wxPdfDocument.

wxPdfDocument

Its author is named Ulrich Telle. wxPdfDocument is a library based on wxWidgets that
allows generating PDF documents. It is one more of the adaptations that have been
realizado de FPDF, la clase original escrita en PHP. Algunos de los scripts en PHP que
you can find on the FPDF website have been incorporated into wxPdfDocument.

In addition to the 14 standard Adobe fonts, it is possible to use other Type1 fonts or
TrueType that can be internal or external to the generated document. In compilations
Unicode also allows the use of CJK fonts. This means you can generate
documents in languages with a character set different from Western. In fact, CJK

3
J. Sánchez. wxPdfCOM. Reference Manual

they are the initials of Chinese, Japanese and Korean (Korea in English). The documentation itself that
The following features are highlighted alongside wxPdfDocument:

• Choice of unit of measure, page format, and margins


• Definition of Header and Footer
• Automatic page jump
• Automatic line break and justified text
• Formatos de imagen soportados (GIF, JPEG, PNG y WMF)
• Colors (Grayscale, RGB, CMYK, Spot colors)
• Links (internal and external)
• 14 Adobe Standard fonts
• TrueType and Type1 fonts (embedded or unembedded), encoding
• TrueType Unicode and Type0 fonts (for Chinese, Japanese, and Korean). Only in
Unicode compilations
• Page compression
• Graphic primitives for the creation of simple graphics
• Masks
• Markers
• Text and image rotation
• Protection through keys and permission management
• Annotations
• Forms (Acroforms). Text fields, combo boxes, check boxes, buttons of
radio, buttons
• JavaScript
• Filling with gradients
• Templates

COM

Microsoft's COM technology (Component Object Model) allows communication.


among software components. COM is used by developers to create
reusable software components, linking components to build applications and
take advantage of Windows services. The COM technology family includes COM+,
DCOM and ActiveX.

Advantages and disadvantages

wxPdfCOM is a library that allows handling wxPdfdocument from languages that


they support the COM model, such as Visual Basic. This implies a series of
advantages for the average programmer.

• It is not necessary to master C++ or wxWidgets to make the most of


wxPdfdocument.
• You have the same features and potential as that library.

4
J. Sánchez. wxPdfCOM. Reference manual

• Regarding PHP, it is not necessary to have a Web server to be able to execute the
scripts.
• Runs faster than PHP, and does not have 'time out' issues in creation of
extensive documents.
• With minor differences, it retains the original syntax of FPDF, so you can
continue inspiring yourself or directly import the sample scripts that abound in
the Network.
• Like the others, it is free.

As for the disadvantages, we find:

• Functions and procedures do not accept a variable number of arguments, in


any call must pass them all.
• In wxPdfCOM, there is no polymorphism; the data types are rigid. This
it imposes a lack of expressiveness that will become evident to those programmers
used to PHP and C++.
• Although it is a free tool, it is not open source.

5
J. Sánchez. wxPdfCOM. Reference manual

Setting up the environment

Register the component

Before you start using the generator, it is necessary to register the component in our
machine and create a reference within the project that will invoke it. To do this you must
open the project menu and select the references option. A window similar to
that of figure 1. In it, the corresponding reference to wxPdfCom must be marked as
as shown in this example.

You may have to


use the Browse button
to search for the Dll library
in the place where it has been
unpacking the file
of installation of
component.

Once selected the


reference pressAccept
to return to the environment of
Visual Basic. Everything will be
ready to start using
wxPdfCOM.

Sometimes it is
posible que al seleccionar la
reference and press accept,
to be produced an error.
An unexpected exit from the Vb6 environment may even occur, with the consequence
immediate loss of the last changes that have not been saved.

In that case, you can try to manually register the component. To do this, you need to
enter the Windows Start menu and select the Run option. In the window of
to execute we must invoke the program [Link] and pass it the path as an argument
complete with wxPdfCom. For example, assuming we have installed the library in
c:/winnt/ we will put:
regsvr32 c:/winnt/[Link]

The system responds with a message saying that the file registration has been successful.
Hooray! Right now, if all has gone well, you are supposed to be ready to start.
to use your favorite PDF file generator. The next thing we can do is to include
the file of predefined constants. Let's see what this file is.

6
J.Sánchez. wxPdfCOM. Reference manual

Constants file

The constants file is a .bas module, which we find in the example project.
with the name [Link], a clear reminiscence of the C language. In fact, the values
what is defined in this file is the same as what wxPdfdocument uses for its
internal functioning. These constants will help us provide greater readability to
our source code.

For example, when we want to express that we wish for a piece of text to appear
centered, we can put the number 2, but it looks much better to put
PDF_ALIGN_CENTER. No one prevents you from renaming these constants to another name that
we like more. Even in other languages different from English.

In the examples of this axial manual as in the examples included in the library and the site
The wxPdfCOM website retains a similar nomenclature to the original for several reasons.
First of all, for the convenience of not having to look for other names, secondly
out of deference to their original authors. And finally for usefulness, they are the constants that
uses the majority, (users of FPDF, wxPdfDocument and wxPdfCOM).

There are several categories of constants that are grouped as follows:

• Definition of frames and borders


• Text alignments (Left, Right, Center)
• Line style

Declaring variables

In order to create our first PDF document, we must declare a variable of the type
suitable. The integrated environment will help us by showing a list of available types
just type dim, the name for our object and a space.

If we have correctly registered the component, in the dropdown list that appears,
we will find the reference we are looking for. See figure. We select [Link] and
our line of code will be as follows.

Dim pdf as [Link]

7
J.Sánchez. wxPdfCOM. Manual de referencia

Assigning memory

Before using it, we have one last step, to assign memory for the object with the
new operator. Just like when we declare the variable, our IDE will show us a
dropdown list with the available options so we don't have to type the name
complete. The new line of code will be as follows.

Set pdf as new pdfdoc

Communicating with wxPdfCOM

We just need to start using our variable. To see a list of the


procedures and attributes of the object, we will type the name of the variable and a dot. From
We will obtain a dropdown list with all the attributes that make up the interface.
of the COM object.

8
J.Sánchez. wxPdfCOM. Reference Manual

User manual

General considerations

Passing arguments

In wxPdfCOM all functions have a fixed number of arguments. This


inconvenience has some consequences that put it at a disadvantage compared to the
versions in other languages. All function calls must pass each and every one
of the arguments that the function expects, even if they are not going to be used.

Fortunately, most procedures are designed to assign values.


by default to the arguments that are passed empty or to zero. But even in that case, the
argument is mandatory. In those cases where the function expects a string of
characters and you do not need to pass one, you must put some double quotes (""). In those
in cases where the function expects a numeric value and you do not want to provide one, you should
write a zero (0).

It is to be expected that this feature will change in future versions of the component with the
introduction of optional arguments.

Array step

The passing of arrays from Visual Basic to wxPdfCOM requires special attention. A
mistake in the way of declaring an array that is to be passed as an argument to a
function can cause errors in the result, or even an automation error and a
program collapse.

In Visual Basic there are several possibilities when it comes to declaring an array. Let's see.
various options.

Option A - Declare a variable without a type, (the compiler will create a variable of the type
variant), and then populate it later using the Array() function. For example:

Two cities
ciudadesArray("Madrid", "Sevilla", "Valencia", "León")

Option B - Declare an array of a specific type and size and assign a value to each of its elements.
members individually:

9
J. Sánchez. wxPdfCOM. Reference Manual

Dim cities(4) as String


ciudades(0)"Madrid"
ciudades(1)"Sevilla"
ciudades(2)"Valencia"
ciudades(3)"León"

The memory representation of these two arrays is different in each case. If we wanted to
create a ComboBox with city names we must pass to the ComboBox function the
second type of array.
All functions that have an array of any type in their argument list will be
may be affected by this peculiarity. It is recommended to examine carefully the
Documentation of those functions before using them or looking at the examples.

If you have problems with any function of this class, the solution may be to change.
the declaration of the array or the way to populate it with data. You have been warned.

See: ComboBox(), ClippingPolygon().

Cumulative arguments

Many of the wxPdfCOM functions have arguments that we will call


'accumulable'. In this section, we will explain the reasons for these arguments and their
mechanism. In the reference of the methods that contain one or several of its arguments
accumulable will be expressly mentioned. The options that can be
Accumulated ones will be accompanied by the + sign to distinguish them.

The C and C++ languages can easily work at the bit level. With them, one can
manipulate a numeric variable and check the activation status of each of its bits.
On numerous occasions, a numeric variable is used to store a series of
state values, where it only stores whether the value of a certain bit is activated or
disabled, true or false. These variables are usually referred to as 'flags'.

The memory savings with the use of flags is considerable since in the case of an integer that
it occupies two bytes, we have eight variables in one. Let's look at a real case, the argument
'border' of the Cell() method. This argument allows us to specify the type of frame that
we wish for the cell. We can select a border for each of the four sides
of the rectangle. The following table shows the predefined constants to use
with the argument 'border'.

PDF_BORDER_NONE 0

PDF_BORDER_LEFT 1

10
J. Sánchez. wxPdfCOM. Reference Manual

PDF_BORDER_RIGHT 2

PDF_BORDER_TOP 4

PDF_BORDER_BOTTOM 8

PDF_BORDER_FRAME 15

Below we show the same table but with the values in binary:

PDF_BORDER_NONE 0000

PDF_BORDER_LEFT 0001

PDF_BORDER_RIGHT 0010

PDF_BORDER_TOP 0100

PDF_BORDER_BOTTOM 1000

PDF_BORDER_FRAME 1111

As you will observe, each of the four sides has been assigned a bit. The left side has
assigned the first bit on the right, the right side has the second bit assigned, the side
the superior is the third and the lower side is assigned the fourth bit.

To achieve a complete frame, we use PDF_BORDER_FRAME, which has


all four bits activated (the binary representation of 15 is 1111).

If we work in C, we can use the 'or' operator to combine the options. Since
example, the expression:

(PDF_BORDER_LEFT | PDF_BORDER_RIGHT | PDF_BORDER_TOP | PDF_BORDER_BOTTOM)

is equivalent to

(PDF_BORDER_FRAME)

To work with wxPdfCOM instead of using the 'or' operator, we have to add the
arguments to obtain a combined effect of them. Note that: 1+2+4+8
adds up to 15. Now imagine that you want to print with Cell() a cell in the shape of a U, it is

11
J. Sánchez. wxPdfCOM. Reference Manual

say, with all the borders activated except the top one, the third one from the right. You will have
to accumulate in the following way:

PDF_BORDER_LEFT + PDF_BORDER_RIGHT + PDF_BORDER_BOTTOM

Or what is the same as adding the decimal values, (1+2+8). The result is 11 which translated to
binary is 1011, where the third bit is disabled. You can use the calculator of
system for making tests, in 'scientific calculator' mode you have radio buttons for
perform conversions between various numerical bases.

Define the document format

Definir un formato será lo primero que tengamos que hacer cada vez que tengamos que
create a new PDF document. It's not the same to create a letter, a novel, or a
calendar, each type of document will be adjusted to standards that often
we will have to continue.
As one of the most widely used formats, A4, letter size, is the default format in
wxPdfCOM. To create a document in A4 format, (210x297mm) it is not necessary to do
Nothing special, apart from declaring a PDF variable and adding pages to it. Only in the case of
if we need a different format, we will need to use the Initialize() function. In such
In this case, this should be the first function we need to call. For more information
check the reference of Initialize().

Document properties

There is a series of functions that help us document our PDF file. These
functions are the ones that appear in Acrobat when we check the properties of the
document. The following list enumerates the most important ones. In the reference
For each of them, you will find more precise instructions for their use.
Argumentos Descripción
SetAuthor() Define the author of the document
SetCreator() Set the name of the application that created the document
SetKeywords() Define the keywords of the document.
SetSubject() Establish the subject of the document
SetTitle() Define the title of the document
SetDisplayMode() Sets the initial display options

Headers and footers

One of the few differences that exist between wxPdfCOM and its predecessors (FPDF and
wxPdfDocument relies precisely on the handling of the header and footer.

12
J. Sánchez. wxPdfCOM. Reference Manual

Both C++ and PHP allow class inheritance. In both cases, the class
original defines the header and footer as virtual functions. The functions
virtuals do absolutely nothing, they have to be defined within the instances of
the class if you want to use its functionality. Then, during the creation of the document
PDF, the functions defined by the editor are called automatically for each new
page that is inserted into the document. Both the header and the footer are defined
only once regardless of the number of pages of the document.

wxPdfCOM does not allow inheriting any function from the original class although that is not
obstacle for us to define a header or footer. Simply the
the procedure is different. The header or footer is defined within a block
Head (or Foot). The Head block starts with the command Head(true) and ends with the
Head(false) command. All commands invoked within this block will not be
they will not be executed immediately but will be stored in memory to be used later.
Not all commands are suitable to be included in a header or footer.
The following table includes a list of the accepted commands. The commands do not
appropriate ones will be executed directly instead of being stored.

Print texts

WxPdfCOM has various methods to print text, from the simple Text()
even the most complex WriteXML. In this section, we will enumerate and compare the
different methods. In the individual reference of each of them you will find
more precise instructions for its use. The most common methods for displaying text
son
Argumentos Descripción
Text() Texto sencillo

RotatedText() Text with rotation

Write() Text without justification

Cell() Text in a single line

ClippedCell() Trimmed text

MultiCell() Multiline text

ImportText() Type from file

WriteCell() Multiline in cells

TextBox() Multi-line, horizontal and vertical alignment

WriteXML() Text with XML tagging

13
J. Sánchez. wxPdfCOM. Reference Manual

ClippingText() Text mask

ShapedText() Text in shape

Text(x,y,txt)

Es tal vez el más sencillo de todos estos métodos. Toma unas coordenadas e imprime el
text that you pass as an argument. If the text is so long that it does not fit in a single line, it
will lose on the right side of the screen.

RotatedText(x,y,txt,angle)

This command is as simple as Text(), but it has a special feature, its


the ability to rotate the text at a specific angle that we provide as
additional argument.

Positive angles cause a rotation counterclockwise and


Negative angles are measured in the same direction as the clock hands. The maximum
The angle value should be 360 although it doesn't matter if a higher number is specified.

Example of RotatedText()

Write(h,txt,link)

Another advantage is that if the text is too long, Write() jumps to the beginning of the
next line and continue writing upon reaching the right margin. Also, you can
convert the text into a hyperlink that when clicked will take the user to the URL or link
specified in the 'link' argument. What Write does not do is justify the text, if the
the next word doesn't fit on the line, it jumps to the next leaving a space between the last
word and the right margin.

Cell(w, h, txt, border, ln, align, fill, link)

Cell() is one of the most commonly used methods to display text. Cell() is based on the
current coordinates to display a text. Optionally, the type can be specified
framed, the alignment and the padding. You can create a hyperlink and decide in which
position will be the pointer after displaying the text. If the text is longer than the
available space, no automatic line break occurs and the text may overflow
cell width. Cell() can be useful for constructing tables.

14
J.Sánchez. wxPdfCOM. Reference manual

ClippedCell(width, height, text, border, line, alignment, fill, link)

This command has exactly the same arguments and works the same as Cell() except
that does not overflow the cell limits, the text is truncated if its length exceeds
the available width. ClippedCell has what could be a bug, the argument w
when it is zero, it makes the cell take up the available line width, however the value
Zero applies to the trimming so that a blank cell appears when w is equal to zero.

MultiCell(width, height, text, border, alignment, fill, max line)

The paragraph you are currently reading is created with MultiCell(). It is another of the
common methods, is very similar to Cell() but has the advantage of extending to several
lines if necessary just like Write() does. Although unlike Write(), MultiCell()
if it supports the alignment.

ImportText (FileName)

ImportText is a special case of MultiCell(), it is based on the current position, it does not use a border.
I fill in and display a justified text. Its peculiarity is that the text is read from a
disk file whose name is the only argument of this method.

WriteCell(h, txt, border, fill, link)

In WriteCell, the cell width is automatically calculated based on the length of the
text. If it exceeds the available width, another cell will be created with its corresponding frame in the
next line and with the precise length to accommodate the remaining text.

TextBox( w,h,txt,halign,valign,border,fill)

This is another command similar to MultiCell. Its most notable feature is that it supports
alignment both vertical and horizontal.

WriteXML (txt)

Another text method with a single argument, in this case, it is a string of text that can
contain HTML tags that will be interpreted accordingly. This command is
multiline.
Argumentos Descripción
... Negrita
... Italica
... Underlined
... Marked
<s> ... </s> Crossed out

15
J. Sanchez. wxPdfCOM. Reference manual

... Bold
... Emphasized, similar to <i>
<small> ... </small> Reduced size
... Superscript
... Subscript
<h1> ... </h1> Labels from one to six
... Text with form

This is an example of WriteXML() to demonstrate the effect of bold, italic tags.


["underlined","overmarked","strikethrough"]smallsubscript

ClippingText(x,y,txt,outline)

It is a special form of text that works as a mask. It comes accompanied by the


UnsetClipping() command. Any graphical output that is emitted between the two commands,
It will only be visible within the limits of the text. The following example illustrates this method.

ShapedText (shape,text,mode)

This method allows for another special effect. It consists of defining a shape with
shape commands and make the text draw along the path of the
defined form.

16
J.Sánchez. wxPdfCOM. Reference manual

Graphs

One of the strengths of the PDF format is its graphic power. In WxPdfCOM it allows
exploit this feature with numerous specialized methods in graphic output.

So much used either in isolation or in combination with each other or with other color methods or
Transformation, the graphical methods will allow you to carry out a large number of effects.
The following is a list of the methods available in wxPdfCOM. Next, you
we show its use with some examples.
Argumentos Descripción
Arrow Draw an arrow

Clippingellipse Ellipse-shaped mask

Clipping Path Custom-shaped mask

ClippingPolygon Polygon-shaped mask

ClippingRect Rectangular mask

DrawCircle Circle

Ellipse Ellipse

Marker Predefined forms

Polygon Polygon

Rect Rectangle

RegularPolygon Regular polygon

RoundedRect Rectángulo de esquinas redondeadas

Sector Sector

Shape Custom form


Definition of custom form,
ShapeCurveTo
curva de Bezier
ShapeMoveto Definition of a custom form

Example of Arrow()

17
J.Sánchez. wxPdfCOM. Reference manual

Source code :

x [Link]
y [Link]
[Link] 0, 0, 0
[Link] 0, 0, 0
[Link] 0, 0, 0
[Link] x, y, db1 + 100, db2, 2, 5, 3

The following example illustrates the use of Clippingellipse(). The ellipse is filled with something
text from a loop. Finally, UnsetClipping() is called to return to normal mode.

Source code:

db1 [Link] + 50
db2 [Link] + 15
[Link] db1, db2, 10, 5, True
For x 0 To 200 Step 5
[Link] x, db2 + 10, "clipped text clipped text clipped text clipped text", 30
Next
[Link]

In the following example, we call [Link]() after creating a shape with


[Link](), ShapeLineTo() and ShapeCurveTo(). The created shape is filled with
text like in the previous case. Finally, we return to normal mode with UnsetClipping()

18
J. Sánchez. wxPdfCOM. Reference Manual

Source code :

db1 [Link] + 50
db2 [Link] + 15
[Link] 'cshape', db1, db2
[Link] 'cshape', db1 + 20, db2 - 10
[Link] 'cshape', db1 + 30, db2 + 10
[Link] 'cshape', db1 + 40, db2 - 10
[Link] 'cshape', db1 + 50, db2 + 15
[Link] 'cshape', db1, db2 + 20, db1, db2 + 20, db1, db2
[Link] 1
[Link] 250, 0, 0
[Link] 'cshape', PDF_STYLE_FILLDRAW
For x from 0 to 200 step 5
[Link] x, db2 + 20, 'clipped text clipped text clippe', 30
Next
[Link]

Example of ClippingPolygon()

Source code:

Let y, z
y Array(70#, 100#, 80#, 110#, 70#)
Array(175#, 195#, 195#, 200#, 205#)
[Link] y, z, True
For x 0 To 200 Step 5
[Link] x, 205, 'clipped text clipped text clippe', 30
Next
[Link]

19
J. Sánchez. wxPdfCOM. Reference Manual

Example of ClippingRect()

Source code:

db1 [Link]
db2 [Link] + 20
[Link] db1, db2, 60, 20, True
For x 0 To 500 Step 5
[Link] x, db2 + 20, "clipped text clipped text", 30
Next
[Link]

Examples of DrawCircle(), (with and without outline) and Ellipse()

Source code :

db1 [Link]
db2 [Link] + 30
[Link] db1, db2, 10, 0, 360, PDF_STYLE_FILLDRAW, 0
[Link] db1 + 30, db2, 10, 0, 180, PDF_STYLE_FILL, 0
[Link] db1 + 60, db2, 10, 5, 20, 0, 360, PDF_STYLE_FILLDRAW, 0

20
J.Sánchez. wxPdfCOM. Reference Manual

Reference of instructions

Accept Page Break

When a page break is necessary, a call to this method occurs. The break of
page is produced whenever the return value of AcceptPageBreak is true. For
the returned value depends on the mode set by SetAutoPageBreak()

This call occurs automatically, so AcceptPageBreak does not have to be


called directly by the application. However, some scripts use this method
to change the margins and achieve text in several columns.

See SetAutoPageBreak()

AddFont

Import a TrueType, TrueTypeUnicode, or Type1 font. The definition file of the


the source must have been created beforehand and be available in a subdirectory
called 'fonts'. SetFontPath can be invoked to set a different folder. The
The source file must also be in this folder whenever you wish to embed it in the
own PDF file.

See: SetFont(), SetFontPath()

Arguments
Indicate the family to which the source belongs. Any can be adopted.
Family name
but if it matches an existing standard name, it will replace it
Style Font style. Possible values in the following table (case insensitive)
Font definition file. An empty string can be passed in
File
in which case the name is constructed from the values family and style
Source
Values for style
(Vacío) Normal
B Bold
I Italica
BI or IB Bold and Italic

AddFontCJK

Import a CJK font (Chinese, Japanese, or Korean). The definition file of the
source must have been created beforehand and be available in the subdirectory
actual.

21
J. Sánchez. wxPdfCOM. Reference Manual

SetFontPath can be invoked to set a different folder. The file of the


source must also be in this folder whenever you want to embed it in the own
PDF file. These fonts require the installation of CJK support for Adobe.

View: SetFont()
Argumentos Descripción
Indicate the family to which the source belongs. Any can be adopted.
name
but if it matches an existing standard name, it will replace it. It does not require
Family
specify style since all available ones are installed The name of
definition file is automatically created with the value 'Family' in
lowercase and without spaces

There are several predefined font definition files

BIG5 Traditional Chinese


BIG5-HW Traditional Chinese Half-width ASCII Characters
GB Chinese (Simplified)
GB-HW Chinese (simplified) Half-width ASCII characters
SJIS Japanese
SJIS-HW Japanese, half-width ASCII characters
UHC Korean
UHC-HW Korean, half-width ASCII characters

AddLink

Create an internal link. An internal link is an area that can be clicked on and jumped to.
another part of the document. Return a valid identifier to pass as an argument to
Cell(), Write(), Image() or Link(). The destination point of the jump is defined with SetLink()

See Cell(), Write(), Image(), Link(), SetLink().

Add Page

Añade una página al documento. Si existe una página anterior, llama a Footer() antes de
create the new page and a Header() for the new one. When creating a new page, the position is
fixed in the upper left corner according to the established margins. The values
previously established, if any, for font type, colors, and line width,
are kept on the new page. The origin of the coordinate system is at the top and to the
left and these increase downward and to the right.

See header(), Footer(), SetMargins()

22
J.Sánchez. wxPdfCOM. Reference Manual

Indicate whether the new page will be vertical or


Orientation landscape. It can adopt one of the
following values.
Orientación vertical. También se puede
1 to use the constant predefined
PORTRAIT
Landscape page. The predefined constant
2 LANDSCAPE

AliasNbPages

Define an alias for the total number of pages. This will be replaced when closing the document.
In FPDF and wxPdfDocument, the default value for this function is 'nb' in curly braces {}.
In wxPdfCPM, its use is recommended for compatibility. There is an internal alias for the
current page number, is for restricted use, its value {pg} and there is no function for
change it.

See PageNo(), Footer()

String that will be replaced by the total number of pages at the end of the
alias
document.
Description
Annotate

Insert a text annotation at the position indicated by the coordinates x and y.


The following is a text annotation inserted with Annotate:

Arguments Descripción

x Abscissa of the annotation

23
J. Sánchez. wxPdfCOM. Reference Manual

y Ordered by the annotation


text Annotation text

AppendJavaScript

Add a piece of Javascript code to a Javascript object at the document level.


A
javascript String of text that contains the JavaScript code.

Rice

Draw an arrow between two points.

See: SetLineWidth(), SetDrawColor(), SetFillColor()

x1 Abscissa of the first point

y1 Ordered from the first point

x2 Abscissa of the second point

y2 Ordered from the second point

linewidth Arrow width

height Height of the arrow tip

height Width of the arrow tip

AxialGradient

Define a shading with axial gradient. Return an integer identifier.

Primary color (RGB or CMYK)


col1
Second color (RGB or CMYK)
col2
Abscissa of the starting point of the degraded vector. (range 0..1)
x1
Ordered from the starting point of the gradient vector. (range 0..1)
y1

24
J.Sánchez. wxPdfCOM. Reference Manual

x2 Abscissa of the second point of the degraded vector. (range 0..1)

y2 Ordered from the second point of the degraded vector. (range 0..1)
Interpolation exponent
intexp

Bookmark

Add a new entry in the document index.

txt Title of the entry

level Level 0 is the highest level. 1 and subsequent represent the sub-headings.

Position (y-coordinate) within the current page. -1 indicates the position.


y
actual
Argumentos Descripción

Cell

Print a cell (rectangular area), allows specifying the framing, background color and
a text. The origin of the cell is the current position of the writing pointer. The text is
it can be aligned to one side or centered. After the call to Cell(), the
position moves right after or jumps to the next line. Cell allows that
texto funcione como un enlace. Si está habilitado el salto de página automático y Cell va
Beyond the limit, a page break occurs beforehand.

View: SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(),


AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak().
A
w Cell width. Zero means to the end of the line

h Cell height. If it is zero, take the default value.

border Define the type of cell border according to the Border table.
It is used to indicate the position of the writing pointer after Cell
ln
0: A continuación, 1: Al inicio de la línea siguiente 2: Debajo
align Set the alignment for the text according to the align table

fill Filling

25
J. Sánchez. wxPdfCOM. Reference Manual

link URL or identifier returned by Addlink()

Possible values for border


BORDER_NONE Without edge

BORDER_LEFT Edge to the left

BORDER_RIGHT Border to the right

BORDER_TOP Top border

BORDER_BOTTOM Bottom border

BORDER_FRAME Edge on all four sides


Description
Being numerical constants, they can be added to combine their effect.

Possible values for alignment


ALIGN_LEFT Left aligned
ALIGN_CENTER Centered text
ALIGN_RIGHT Right aligned
ALIGN_JUSTIFY Justified text

CheckBox

Add a 'check box' type field to the list of fields in the form.
A
name Assigned name to the field
x Abscissa of the position
y Ordered from the position
width Field width
checked Default value

ClippedCell

This function is the same as Cell() except that the cell is cropped when it exceeds the limits of
rectangle. Print a cell (rectangular area), allows specifying the framing, the
background color and a text. The origin of the cell is the current position of the pointer.

26
J.Sánchez. wxPdfCOM. Reference Manual

writing. The text can be aligned to one side or be centered. After the
call to Cell(), the position moves right after or jumps to the next line. Cell
permite que el texto funcione como un enlace. Si está habilitado el salto de página
automatic and Cell goes beyond the limit, a previous page break occurs.

Ver: SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(),


AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak().
Ar

w Cell width. Zero means up to the end of the line.

h Cell height. If it is zero, take the default value.

Define the type of cell framing according to the Border ln table.


It serves to indicate the position of the writing pointer after
border
Cell 0: A continuación, 1: Al inicio de la línea siguiente 2:
Below

align Set the alignment for the text according to the 'alignment' table

fill Filling

link URL or identifier returned by Addlink()

Description
Possible values for border
BORDER_NONE Without edge

BORDER_LEFT Edge to the left

BORDER_RIGHT Border to the right


Top border
BORDER_TOP
Bottom border
BORDER_BOTTOM
Edge on all four sides
BORDER_FRAME

27
J. Sánchez. wxPdfCOM. Reference Manual

Argumentos Descripción
As they are numerical constants, they can be summed to combine their effect.

Possible values for alignment


Argumentos Descripción
ALIGN_LEFT Left aligned

ALIGN_CENTER Centered text

ALIGN_RIGHT Aligned to the right

ALIGN_JUSTIFY Justified text

ClippingEllipse

Define a framing area in the shape of an ellipse.


Argumentos Descripción
x Abscissa of the position

y Ordered from the position

rx Horizontal radio

ry Vertical radio, if the result is zero it will be a circle

outline Determine if the profile will be drawn

Clipping Path

Define a mask in the shape of an object shape. A mask restricts the output.
preventing any element from being displayed outside the area defined by it.
Argumentos Descripción
Name of the Shape object that defines the area of
shape
mask
style Drawing style can be one of the following:

PDF_STYLE_NOOP Without style, default value.

PDF_STYLE_DRAW Draw outline

PDF_STYLE_FILL Filling

28
J. Sánchez. wxPdfCOM. Reference Manual

PDF_STYLE_FILLDRAW Draw outline and fill

ClippingPolygon

Define a polygon as a framed area. A framed area restricts the output and
prevents objects from being displayed outside of it.
Argumentos Descripción
x Array of abscissas

y Ordered array

outline Boolean value of contour definition.

ClippingRect

Define a rectangle as a framed area. A framed area restricts the output and
prevents objects from being displayed outside of it.
Argumentos Descripción
x X-coordinate of the upper left corner

y Ordered from the top left corner

w Width of the rectangle

h Height of the rectangle

outline Boolean value that defines whether the contour is drawn

ClippingText

Define a text as a framing area. A framing area restricts the output and
prevents objects from being displayed outside of it.
Argumentos Descripción
x Abscissa of the upper left corner

y Ordered from the top left corner

txt Text

outline Boolean value that defines whether the outline is drawn

29
J. Sánchez. wxPdfCOM. Reference manual

CloseFile

Finalize the editing of the PDF document. It is not necessary to call this method.
explicitly since SaveFile() does it automatically. If no page exists
in the document, Close() calls AddPage() to prevent the creation of a document
invalid.

See: Open(), SaveAsFile()

ClosePath

Close the framing path. A framing area restricts the output by preventing that
some element is drawn outside the defined area.
Argumentos Descripción
style Style

The following style options are available


PDF_STYLE_NOOP none

PDF_STYLE_DRAW Outline drawing

PDF_STYLE_FILL Filling

PDF_STYLE_FILLDRAW Filling and contour

ComboBox

Add a combo type field at the specified coordinates or at the current position.
The list of values will be an array of strings where each element will be populated.
independently. Use the array() function in Visual Basic to assign elements to a
Variant would cause an error if we try to pass it to ComboBox.
Argumentos Descripción
name Field name

x Abscissa, if left at zero takes the value of GetX()

y Ordered, if left at zero, it takes the value of GetY()

width Width

height High

values Array of strings for the content

30
J.Sánchez. wxPdfCOM. Reference manual

Convert2Roman

Takes an integer as an argument and returns a string with its


representation in Roman numerals. This function can be useful for numbering pages or
chapters of a document.
Argumentos Descripción
value Integer value that you want to convert

Curve

Draw a Bezier curve. A Bezier curve is tangent to the line that connects the points.
de control a cada lado de la curva.
Argumentos Descripción
x0 Abscissa of the starting point

y0 Ordered from the starting point

x1 Abscissa of the first control point

y1 Ordered from the first checkpoint

x2 Abscissa of the second control point

y2 Ordered from the second checkpoint

x3 Abscissa of the endpoint

y3 Ordered from the endpoint

style Curve style. Outline/Fill

PDF_STYLE_DRAW Contour

PDF_STYLE_FILL Fill

CurveTo

Add a cubic Bezier curve to the current path or subpath. The curve extends from the
current point to the point (x3,y3), using control points 1 and 2. Set (x3,y3)
as a new current point.

See Curve()

31
J. Sánchez. wxPdfCOM. Reference manual

Argumentos Descripción
x1 Abscissa of the first control point

y1 Ordered from the first checkpoint

x2 X-coordinate of the second control point

y2 Ordered from the second checkpoint

x3 Abscissa of the endpoint

y3 Ordered from the endpoint

DrawCircle

Draw a circle given the coordinates of its center, the radius, and the start and end angles.
The angle values must be between 0 and 360. A final angle of 0 is
interpret as 360.
Argumentos Descripción
x0 Abscissa of the position

y0 Ordered from the position

r Circle radius

start Initial angle

afinish Final angle

style Style drawing and/or filling

nseg The circle is composed of up to nSeg Bezier curves.

Ellipse

Draw an ellipse
Argumentos Descripción
Abscissa of the center
x0
Ordered from the center
y0
Horizontal radio
rx

32
J. Sánchez. wxPdfCOM. Reference manual

Vertical radio. If ry is zero, the result will be a


ry
circle
Rotation angle. Counterclockwise
angle
clock
Exit angle
start
Final angle
afinish
Style (Outline/Fill)
style
The ellipse is composed of nSeg Bezier curves.
nSeg

EndTemplate

Finish a template. Restore the variables initialized with BeginTemplate(). If it exists.


a template under construction, returns its identifier. Otherwise, it returns zero.

See: BeginTemplate(), UseTemplate().

Footer

Starts or ends the definition of the footer. Takes a boolean value as an argument.
(true or false) that defines the beginning and the end of the footer definition block. No
All commands are suitable for inclusion in the block. It is necessary to close a block.
that has been opened.
Argumentos Descripción
Valor de comienzo/fin de la definición del
define
footer block
True The recording of the block begins.

False End the recording of the block

GetBreakMargin

Returns the value of the margin for the page break.

GetCellMargin

Returns the margin of Cell().

GetFontFamily

Return the family name of the current font.

33
J. Sánchez. wxPdfCOM. Reference manual

See: SetFont()

GetFontPath

Returns the path of the folder where the font definition files will be searched.
By default, its name is /fonts but it can be changed with SetFontPath().

GetFontSize

Return the size in points of the current font

See: SetFont()

GetFontStyle

Returns the current font style.

See: SetFont()

GetFontSubsetting

Returns true or false, depending on whether partial font inclusion is enabled.


Unicode. If we use any font different from the 14 basic Adobe fonts,
We should include its definition in the PDF file. Embed fonts within the
documents cause them to increase in size, especially when using Unicode fonts,
that contain thousands of characters. To reduce the size of these files, one can
include subsets of the characters that will be used. wxPdfDocument and
Consequently, wxPdfCOM allows for the partial inclusion of fonts for Unicode fonts.

GetImageScale

Return the scale of the image.

GetLeftMargin

Return the left margin.

See: SetLeftMargin().

GetLineHeight

Returns the height of a line of text.

GetLineWidth

Returns the current line width.

34
J. Sánchez. wxPdfCOM. Reference manual

See Line(), Rect(), Cell(), MultiCell()

GetPageHeight

Returns the current page height in units.

GetPageWidth

Returns the current page width.

GetScaleFactor

Return the scaling factor (the number of points per user unit).

GetStringWidth

Returns the length of a string in the user's unit. Takes into account
the current font type, its style and size. There should be a selected font.
Argumentos Descripción
s String whose length the function will return

GetTemplateBBox

Get the dimensions of an external model The dimensions of the imported pages
External PDF documents are often of interest. This function takes part of your
arguments by reference and deposit the result in them. The returned values are
correspond to the coordinates of the bottom left point, the width and the height of the model
or template.

Ver: SetTemplateBBox(), BeginTemplate(), ImportPage().


Argumentos Descripción
templateId It is a valid template identifier

x Abscissa of the bottom left corner

y Ordered from the bottom left corner

width Model width

height Model height

GetTemplateSize

35
J.Sánchez. wxPdfCOM. Reference Manual

Gets the calculated size of a model or template. The width and/or height must have a
value less than or equal to zero to be calculated. If one of these values is exceeded with value
zero, will be returned with the value calculated in proportion to the other element.

See: BeginTemplate(), EndTemplate(), UseTemplate(), ImportPage()


Argumentos Descripción
templateId Es un identificador de plantilla válido

width Model width

height Model height

GetTopMargin

Return the top margin.

GetX

Returns the abscissa of the current position.

See SetY(), GetY(), SetX()

GetY

Return the ordinate of the current position.

See SetY(), GetX(), SetX()

HEADER

Starts or ends the definition of the page header. Takes a value as an argument.
logical (true or false) that defines the beginning and the end of the header definition block.
Not all commands are suitable to be included in the block. It is necessary to close a
block that has been opened.
Argumentos Descripción
Start/end value of the definition of the
define
header block of page
True : The recording of the block begins

False : End the recording of the block

36
J. Sánchez. wxPdfCOM. Reference manual

Image

Print an image in the specified position and with the specified dimensions. Optionally
can include a link or can be displayed delimited by a mask. The
coordinates of the top left corner must be specified.
As for the dimensions, they can be given explicitly or let wxPdfCOM determine them.
Calculate. If one is exceeded, the other is calculated proportionally. If both width and ...
If set to zero, the image will be displayed at 72 dots per inch. The recognized formats
JPEG, PNG, GIF, and WMF. For JPEG, the following types are supported: Grayscale,
true color (24 bits), and CMYK (32 bits). The following formats are supported for PNG
Grayscale of up to 8 bits (256 levels), indexed color, true color (24 bits).
However, it does not support interlacing or the alpha channel. If a transparent color is defined
will be taken into account but will only be interpreted by Acrobat 4 and above.

The supported GIF formats depend on the wxWidgets decoder. wxPdfCOM is


compiled with the latest version available at the time of preparing this manual (version 2.8.3).
WMF files contain vector images described using GDI commands.
of Windows (Graphics Device Interface). There are about 80 different commands in the WMF
standard. This method only supports some of them, although they are sufficient for the
majority of the existing WMF images. In order to optimize the size of the
documents created, the images included multiple times are only stored once. This
It represents a great savings when the same image is used repeatedly.
Argumentos Descripción
file File name containing the image
Abscissa of the top left position where it will be displayed.
x
image
y Ordered from the top left corner of the image

w Width of the displayed image or zero for automatic calculation

h height of the displayed image or zero for automatic calculation

link Link address

maskimage Mask identifier previously created with ImageMask()

ImageMask

Prepare an image for use as a mask. Return a mask identifier.


valid or zero if an error occurs.
Argumentos Descripción
file Name of the file that contains the image

37
J.Sánchez. wxPdfCOM. Reference Manual

ImportPage

Import a page from the external PDF document. The outline used will be the ArtBox of the
imported page, if it has been defined. If not, the CropBox will be used and if not the
MediaBox. The return value is an index of the imported page that can be used with
UseTemplate(). If the specified page is out of range or has not been selected
source ImportPage() will return zero.

See: SetSourceFile(), UseTemplate().


Argumentos Descripción
page number Page number to import

ImportText

Read a text file and print it in the current document. Respect the line breaks.
manuals and automatically inserts the necessary ones if a line is too long. The
text appears justified.
Argumentos Descripción
filename File name to import

Initialize

Define initial values of the document. It is not essential to call this method, but if
It must be done before anyone else. It serves to determine the default orientation.
what the pages will have, the unit of measurement, and the type of paper. In reality, this function does not
It should have the first of its arguments since the orientation should indicate for
each page that is added. This redundancy is due to the fact that wxPdfCOM does not support
empty arguments may disappear in future versions where presumably
the default arguments are to be introduced.

The supported paper types are the same as wxWidgets. Currently, there are 116 types.
different ones to choose the one that best meets our needs without being
It is possible to create different sizes than these. If the call to Initialize is omitted, the document
It will be A4 size.
Argumentos Descripción
orientation Default orientation type

unit Unit of measurement

paper Type of paper

38
J. Sanchez. wxPdfCOM. Reference Manual

Lin

Draw a line between two points. Line takes into account the established values for width.
of line and color. Do not confuse with Ln() which is used to create line breaks.

See: SetLineWidth(), SetDrawColor()


Argumentos Descripción
x1 Abscissa of the origin point
y1 Ordered from the origin point
x2 Abscissa of the destination point
y2 Ordered from the destination point

Line Count

Calculate the number of lines that a text would occupy considering the available width.
and the current font size.
Argumentos Descripción
w Available width
text Text for which the calculation is desired

Ln

It causes line breaks of variable height.


The new position is set on the left margin. The height of the jump depends on the
argument, by default the height of the last printed cell is taken.

See: Cell();
Argumentos Descripción
h Height of the jump, if it is zero take the height of the last cell

Marker

Draw a mark.
Argumentos Descripción
x Abscissa of the center of the mark
y Ordered from the center of the brand
markerType One of the types from the following table
size Brand size

List of types for Marker()

PDF_MARKER_CIRCLE

39
J.Sánchez. wxPdfCOM. Reference manual

PDF_MARKER_SQUARE
PDF_MARKER_TRIANGLE_UP
PDF_MARKER_TRIANGLE_DOWN
PDF_MARKER_TRIANGLE_LEFT
PDF_MARKER_TRIANGLE_RIGHT
PDF_MARKER_MARKER_DIAMOND
PDF_MARKER_PENTAGON_UP
PDF_MARKER_PENTAGON_DOWN
PDF_MARKER_PENTAGON_LEFT
PDF_MARKER_PENTAGON_RIGHT
PDF_MARKER_STAR
PDF_MARKER_STAR4
PDF_MARKER_PLUS
PDF_MARKER_CROSS
PDF_MARKER_SUN
PDF_MARKER_BOWTIE_HORIZONTAL
PDF_MARKER_BOWTIE_VERTICAL
PDF_MARKER_MARKER_ASTERISK

MirrorH

Perform a horizontal reflection transformation. This function is equivalent to scaling by -100 in


the address of x. To return to normal scaling, you must pass the value 100.
Argumentos Descripción
x Abscissa of the reflection axis

MirrorV

Perform a vertical reflection transformation. This function is equivalent to scaling by -100.


direction and. To return to a normal scale, you need to set the value to 100.
Argumentos Descripción
y Abscissa of the axis of reflection

MoveTo

It jumps the drawing pointer to a new position. This must be the first operation.
after ClippingPath().
Argumentos Descripción
x Abscissa of the new position
y Ordered from the new position

40
J.Sánchez. wxPdfCOM. Reference Manual

MultiCell
This method allows printing text with line breaks. These will be inserted
automatically as soon as the text reaches the right edge of the cell, or manually.
The necessary cells will be drawn, one beneath the other. The text can appear
aligned justified or centered. You can specify a border and a padding.
Argumentos Descripción
w Cell width. Zero means to the end of the line

txt Text to print

border Define the cell border type according to the Border table.
It serves to indicate the position of the writing pointer after
ln
Cell
0: Next

1: At the beginning of the next line

2: Below

align Set the alignment for the text according to the align table

fill Filling

maxline Maximum number of lines. If it is zero, there is no limitation.

Possible values for border


BORDER_NONE Without edge

BORDER_LEFT Border to the left

BORDER_RIGHT Border to the right

BORDER_TOP Top edge

BORDER_BOTTOM Bottom border

BORDER_FRAME Edge on all four sides

As numerical constants, they can be added to combine their effect.

41
J.Sánchez. wxPdfCOM. Reference manual

Possible values for alignment


Argumentos Descripción
ALIGN_LEFT Left aligned

ALIGN_CENTER Texto centrado

ALIGN_RIGHT Aligned to the right

ALIGN_JUSTIFY Justified text

OpenPdf

This method starts the generation of a PDF document. OpenPdf() does not create any pages.
AddPage() automatically invokes the internal Open() method if necessary.

See: AddPage(), Close().


PageNo

Returns the current page number.

See: AliasNbPages()

Polygon

Draw a polygon with optional outline and fill.


Argumentos Descripción
x Array of abscissas

y Ordered array

style Style (outline and/or fill)

PDF_STYLE_DRAW : Draw outline

PDF_STYLE_FILL : Dibuja relleno

PDF_STYLE_FILLDRAW : Draw outline and fill

PushButton

Add a button to the page in the current position. The button is included in the field list.
from the form (acroform), a snippet of JavaScript can be included as an action
of the button.

42
J. Sanchez. wxPdfCOM. Reference Manual

Argumentos Descripción
name Field name

width Button width

height Button height

caption Text that appears on the face of the button

action Associated JavaScript code

RadioButton

Add a radio button in the current position.


Argumentos Descripción
group Name of the group to which you belong

name Field name

width Radio button feature

Rect

Draw a rectangle. The outline and fill are optional. Take the values into account.
of established color and line width.

See SetLineWidth(), SetDrawColor(), SetFillColor().


Argumentos Descripción
x X-coordinate of the upper left corner

y Ordered from the upper left corner

w Width

h Height

style Style (outline and/or fill)

PDF_STYLE_DRAW : Draw outline

PDF_STYLE_FILL : Draw fill

PDF_STYLE_FILLDRAW : Draw outline and fill

43
J. Sánchez. wxPdfCOM. Reference Manual

Regular Polygon

Draw a regular polygon, optionally a circle can be inscribed inside it.


Argumentos Descripción
x0 Abscissa of the center

y0 Ordered from the center

r Inner circle radius

ns Number of sides

angle Orientation angle

circle Logical value. Indicates whether the inner circle is drawn.

style Polygon style (draw/fill)

circlestyle Inscribed circle style (draw/fill)

Rotate

Perform a rotation around a center. The rotation affects all elements.


printed below, with the exception of the 'clickable' areas. The GetX methods and
GetY are not affected. The rotation also does not affect the automatic jump mechanism.
page. The rotation does not carry over from one page to another. Each new page starts with
zero rotation.
Argumentos Descripción
angle Rotation angle in degrees

x Abscissa of the center of rotation

y Ordered from the center of rotation

RotatedImage

Show an image with rotation. You need to specify the origin coordinates of the
image shown. The dimensions can be explicit or calculated just like happens
with Image(). It supports common formats (JPG, PNG, GIF, BMP, and WMF). The type of
image is automatically inferred from the file extensions. The image may
serve as a link. Just like with Image(), the images used multiple
sometimes in the same PDF file, they are only stored once to save space.

44
J. Sánchez. wxPdfCOM. Reference manual

See:Image()
Argumentos Descripción
x X-coordinate of the upper left corner

y Ordered from the top left corner

w Image width. If it is zero, it is calculated.

h Image height. If it is zero, it is calculated.

angle Rotation angle

link Link

maskImage Mask identifier created with ImageMask()

RotatedText

Print a text with rotation.


Argumentos Descripción
x Abscissa of the center of rotation

y Ordered from the center of rotation

txt Text to show with rotation

RoundedRect

Draw a rectangle with rounded corners. In the selection of the corners that you
They are going to draw rounded shapes; the values can be summed to obtain results.
intermediate. This way, it is not necessary to curve just one corner (or all of them), but rather
You can draw rectangles with two or three rounded corners.
Argumentos Descripción
x Abscissa of the top left corner

y Ordered from the top left corner

w Width of the rectangle

h Height of the rectangle

r Corner radius

45
J. Sánchez. wxPdfCOM. Reference Manual

Selection of rounded corners, they should not be the


rounded corner
four corners
No curved corners. For this, I recommend you.
PDF_CORNER_NONE :
Rect()
PDF_CORNER_TOP_LEFT : Select the top left corner

PDF_CORNER_TOP_RIGHT : Select the top right corner

PDF_CORNER_BOTTOM_LEFT : Selecciona la esquina bajo izquierda


PDF_CORNER_BOTTOM_RIGHT
Select the bottom right corner
:
PDF_CORNER_ALL : All corners rounded.
style
Style (outline and/or fill)

PDF_STYLE_DRAW : Draw outline

PDF_STYLE_FILL : Draw fill

PDF_STYLE_FILLDRAW : Draw outline and fill

Save As File

Save the created document to a disk file. Close() is called if necessary.


If an empty name is passed, a document called '[Link]' will be saved if it exists.
the file will be overwritten. If it exists and is open, it may cause a
error or simply not being recorded. Therefore, you have to make sure that the file, if
it exists, it is closed.

See Close()
Argumentos Descripción
name File name. An empty string is equivalent to '[Link]'

Scale

Modify the scale in the X and Y directions. The transformation is applied in a


independent for each dimension.
Argumentos Descripción
sx Scaling factor in width. Zero is not allowed.

sy Height scaling factor. Zero is not allowed.

46
J. Sánchez. wxPdfCOM. Reference Manual

x Abscissa of the scaling center

y Ordered from the scaling center

ScaleX

Modify the scale only in the x direction.

ScaleXY

Perform scaling both widthwise and heightwise.


Argumentos Descripción
s Width scaling factor. Zero is not allowed.

x Abscissa of the scaling center

y Order from the scaling center

ScaleY

Modify the scale only in the y direction.


Argumentos Descripción
sy Scaling factor in height. Zero is not allowed.

x Abscissa of the scaling center

y Ordered from the scaling center

Sector

Draw a sector
Argumentos Descripción
x0 Abscissa of the central point.

y0 Ordered from the central point

r Radio

start Initial angle.

47
J.Sánchez. wxPdfCOM. Reference Manual

finish Final angle

style Style

PDF_STYLE_DRAW : Draw outline

PDF_STYLE_FILL : Draw fill


PDF_STYLE_FILLDRAW
Draw outline and fill
:
clockwise Clockwise (if true), counterclockwise (if
false)
origin
Origin of angles.

0: At three

90 : At twelve

180: At 9

270: At 6

SetAlpha

Set the values for Alpha and BlendMode. Return an identifier for later use.
use.
Argumentos Descripción
Alpha value for strokes. It is a value between
lineAlpha
zero (transparent) and 1 (opaque)
Alpha value for filling. It is a value between
fillAlpha
zero (transparent) and 1 (opaque)
Value for BlendMode. One of the constants.
blend mode
next:
PDF_BLENDMODE_NORMAL

PDF_BLENDMODE_MULTIPLY

PDF_BLENDMODE_SCREEN

PDF_BLENDMODE_OVERLAY

PDF_BLENDMODE_DARKEN

PDF_BLENDMODE_LIGHTEN

48
J. Sánchez. wxPdfCOM. Reference Manual

PDF_BLENDMODE_COLORDODGE

PDF_BLENDMODE_COLORBURN

PDF_BLENDMODE_HARDLIGHT

PDF_BLENDMODE_SOFTLIGHT

PDF_BLENDMODE_DIFFERENCE

PDF_BLENDMODE_EXCLUSION

PDF_BLENDMODE_HUE

PDF_BLENDMODE_SATURATION

PDF_BLENDMODE_COLOR

PDF_BLENDMODE_LUMINOSITY

SetAlphaState

Activate a previously defined Alpha state.


Argumentos Descripción
id Identifier returned by SetAlpha()

SetAuthor

Define the author of the document.

View: SetCreator(), SetKeywords(), SetSubject(), SetTitle()


Argumentos Descripción
author Author's name

SetAutoPageBreak

Turn on or off automatic page jump. If activated, the second


parameter defines the bottom margin. The default state is Enabled with a margin of
two centimeters.

See: Cell(), MultiCell(), AcceptPageBreak()


Argumentos Descripción

49
J.Sánchez. wxPdfCOM. Reference Manual

autopagebreak Value of state activated/deactivated

margin Distance from the bottom of the page

SetCellMargin

Define the margin for the cells. It can be called before creating the first page.
Argumentos Descripción
margin Value of the margin

SetCompression

Enable or disable page compression. If enabled, the internal representation of each


the page is compressed and the resulting document is reduced by about half. The
compression is enabled by default.
Argumentos Descripción
compress Logical value of compression (True or False)

SetCreator

Define the creator of the document. It is usual to put the name of the application that created it.
the document. In the freeware versions of wxPdfCOM, the default value is
'wxPdfCOM' cannot be changed with SetCreator().

Ver: SetAuthor(), SetKeywords(), SetSubject(), SetTitle()


Argumentos Descripción
The name of the program that has been created by the
creator
document.

SetDisplayMode

Define how the document should be displayed in the viewer. It can be established the
initial zoom level to one of the preset levels, to a precise factor or let the
set the default level. (In Acrobat, the default zoom can be chosen in
the 'Preferences' menu). Page settings can also be specified. The mode
By default, it is full screen and continuous.
Argumentos Descripción
zoom Type of zoom. One of the following

PDF_ZOOM_FULLPAGE: Full page

PDF_ZOOM_FULLWIDTH : Full screen width

50
J.Sánchez. wxPdfCOM. Reference manual

PDF_ZOOM_REAL: Actual size

PDF_ZOOM_DEFAULT : Default zoom of the viewer

PDF_ZOOM_FACTOR : Value of the third argument zoomFactor


layout
Page setup: One of the following

PDF_LAYOUT_SINGLE : Show one page at a time

PDF_CONTINUOUS_LAYOUT

PDF_LAYOUT_TWO

PDF_LAYOUT_DEFAULT
zoomFactor If zoom is PDF_ZOOM_FACTOR the percentage of
zoom will be about this argument

SetDrawColor

Define the color used for drawing operations. The affected operations are the
lines, rectangles, and cell borders. The color is expressed by the combination of the
red, green, and blue colors (RGB). The method can be invoked before creating the first
the page and its value are preserved for all pages or until it is changed.
See SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell()
Argumentos Descripción
red Red level. It is a value between 0 and 255

green Green level. It is a value between 0 and 255

blue Blue level. It is a value between 0 and 255.

SetFillColor

Define the color for fill operations. The operations where filling is used.
they are the rectangles with the fill option activated, the backgrounds of the cells, etc. It is possible to
establish before creating the first page and the value is retained for all pages or
until it is reestablished with SetFillColor().

See SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell()


Argumentos Descripción
red Red level. It is a number between zero and 255.

51
J. Sánchez. wxPdfCOM. Reference Manual

green Green level. It is a number between zero and 255

blue Blue level. It is a number between zero and 255.

SetFillGradient
Draw a rectangular area with gradient.
Argumentos Descripción
Abscissa of the top left corner of the
x
rectangle
h Height

gradient Gradient identifier

SetFont

Set the font used to display character strings. It is necessary


set a font type before displaying any text. Otherwise the result does not
it will be the expected one. In reality, the default font of a newly created document is
'ZapfDingbats'. If you do not select any font and print something, it is possible that it
the only thing you see is hearts, circles and other symbols. The font type can be one of
the standard or one of those added via the AddFont() method. The fonts
estándar utilizan el código cp1252 (Western Europe) de windows. El método se puede
invoke before creating the first page and thus its effect will affect the entire document or until
that another source be established.

The 'family' argument can be an empty string. In that case, the current family is retained.
and only the other arguments are taken into account. We can use SetFont() to change the
font size although it is more direct to do it with SetFontSize() if it is the size
the only thing we want to change. Style options can be combined to achieve
combined effects. In symbolic fonts, the 'Bold' and 'Italics' styles have no effect.
'Itálica'. In size, you can set it to zero, in which case the previously set size will be retained.
established at 12, (the default value), if it has not been specified at any time.

See AddFont(), SetFontSize(), Cell(), MultiCell(), Write()

Arguments Description
family Font family. standard of those that are
they show or a defined one with AddFont()
Courier (fixed width)

Helvetica or Arial (synonyms; sans serif)

Times (serif)

52
J.Sánchez. wxPdfCOM. Reference Manual

Symbol (symbols)

ZapfDingbats (symbols)
style
Font style

Empty chain : Normal

B: Bold)

I: Italica

BI or IB: Bold/Italic

U: Underlined
size
Font size in points.

SetFontPath

Declare the location of the font definition files. wxPdfCOM uses


XML definition files for embedding fonts in PDF documents. The
definition file and the source file, in case of inclusion, must be present in
the path declared by SetFontPath(). If an empty string is passed, it will take the path of the
environment variable WXPDF_FONTPATH. If the environment variable does not exist
WXPDF_FONTPATH will look for files in the 'fonts' folder of the current directory.
Argumentos Descripción
fontPath Default path to search for font files

SetFontSize

Define the font size.

See SetFont()
Argumentos Descripción
size Font size defined in points

Set Font Subsetting

Set the font inclusion mode. If a PDF document uses additional fonts
to the 14 standard basic sources, the information from the
the same. The result is that the documents increase considerably in size,
especially if Unicode fonts are used, which often include thousands of symbols.

53
J. Sánchez. wxPdfCOM. Reference Manual

To reduce the size of these files, only the characters that can be included
utilicen en el documento. SetFontSubsetting() sirve precisamente para activar o desactivar
this option only works for TrueType Unicode fonts.
Argumentos Descripción
Enable/disable partial inclusion of Truetype fonts
font subsetting
Unicode
SetFormBorderStyle

Set the border style of the form fields. The thickness and the can be modified.
style of all fields included until a new call to
SetFormBorderStyle() with different values.
Argumentos Descripción
borderStyle Style of the border of form fields

PDF_BORDER_SOLID

PDF_BORDER_DASHED

Beveled Border

PDF_BORDER_INSET

PDF_BORDER_UNDERLINE

borderWidth Edge width

SetFormColors

Set the colors of the form fields. Define one color for the border, another for
the background and a color for the text. The three colors are expressed in RGB.
Argumentos Descripción
Red component for the edge. It is a value.
BRed between 0 and 255
Green component for the edge. It is a value.
BGreen between 0 and 255
Blue component for the edge. It is a value
BBlue between 0 and 255
Red component for the background. It is a value.
BKRed between 0 and 255
Green component for the background. It is a value
BKGreen between 0 and 255
Blue component for the background. It is a value.
BKBlue between 0 and 255
Red component for the text. It's a value.
TRed between 0 and 255

54
J. Sánchez. wxPdfCOM. Reference Manual

Green component for the text. It is a value.


TGreen between 0 and 255
Blue component for the text. It is a value.
TBlue between 0 and 255

SetImageScale
Set the image scale
Argumentos Descripción
scale Image scale

SetKeywords

Associate a series of keywords with the document. The keywords are a clue about the
content of the document, just as happens with the keywords of .html files.
Internet search engines usually read these words to classify pages based on their
content. The argument is a string of characters that contains several words separated
through spaces.

See: SetAuthor(), SetCreator(), SetSubject(), SetTitle()


Argumentos Descripción
keywords List of keywords separated by spaces

SetLeftMargin

Define the left margin. This method can be called before creating the first page.
If the current value of X falls outside the margin, its value is automatically adjusted.

See SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()


Argumentos Descripción
margin Value for the left margin

SetLineHeight

Sets the height of a line of text.


Argumentos Descripción
height Line height

SetLineWidth

Define the line width. By default, the line width is 0.2 mm. The line width is
it can be set before creating the first page and is retained for the following ones.

See Line(), Rect(), Cell(), MultiCell()

55
J.Sánchez. wxPdfCOM. Reference manual

Argumentos Descripción
width Line width value

SetLink

Define the page and the position to which a link points.


See: AddLink()
Argumentos Descripción
link Identifier of the link created with AddLink()
Ordered from the position. -1 indicates the current position. 0 indicates the
y
top of the page
page Destination page number. 0 and -1 indicate the current page

SetMargins

Define the top, left, and right margins. The default value for the margins.
It is 1 cm. To modify the bottom margin, use the SetAutoPageBreak() method.

See: SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak()


Argumentos Descripción
left Left margin
top Upper margin
right Right margin

SetProtection

Define the permissions that the document will have. Set the user and owner passwords.
If this function is not used, the document will have all permissions except for
modification. In case of using it, it will only have the permissions that are expressly activated.

It is not necessary to set the user and owner keys. If you specify a key for
the viewer, (Acrobat), will ask for it to open the document.

If you specify an owner key, it will be used to open the document without
restrictions. When choosing a length for the key, keep in mind that the value for
default (if you set zero) you will adopt the standard method, revision 2 with a length of 40 bits.
If you set a value greater than zero, you will adopt the standard method, revision 3 with the length.
de clave dada, pero ten en cuenta que esta deberá estar entre 40 y 128 y además ser
multiple of 8. Otherwise, its length will adjust to these conditions. When it comes to
establish encryption keys, noting that Acrobat only supports 40 and 128 keys
bits.
permissions Code to activate the permissions. (+) Argument
accumulative

56
J. Sánchez. wxPdfCOM. Reference Manual

PDF_PERMISSION_NONE
+ PDF_PERMISSION_PRINT
+ PDF_PERMISSION_MODIFY
+ PDF_PERMISSION_COPY
+ PDF_PERMISSION_ANNOT
PDF_PERMISSION_ALL
userPassword User key
ownerPassword Owner key
encryptionMethod Encryption method
PDF_ENCRYPTION_RC4V1
PDF_ENCRYPTION_RC4V2
PDF_ENCRYPTION_AESV2
keyLength Key length

Set Right Margin

Define the right margin. This method can be called before creating the first page.

See: SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins().


Argumentos Descripción
margin Right margin

SetSourceFile

Establish an external document to use as a template. With wxPdfCOM you can


import pages from an external document. WxPdfCOM/wxPdfDocument generally
they produce PDF documents version 1.3 although they can import documents up to 1.6. In
In these cases, the version of the produced document will be changed to the version of the document.
imported.
It is necessary for the permissions to print, copy, and extract text and graphics to be
activated in the original document. Otherwise it will not be possible to use it as a template.
external. SetSourceFile() returns the number of pages of the analyzed document or zero if
there has been an error.

See: ImportPage(), UseTemplate().


Argumentos Descripción
filename Name of the external document
password User key, only if necessary

SetSubject

Establish the subject of the document.


Argumentos Descripción
subject Subject of the document

57
J.Sánchez. wxPdfCOM. Reference Manual

SetTemplateBBox

Define the visible sector of a model. It will be a rectangular area. The model will be loaded.
complete, but we can define which part will be visible in our document.

See: GetTemplateBBox(), BeginTemplate(), ImportPage().


Argumentos Descripción
templateId Model identifier

x Abscissa of the top left corner

y Ordered from the top left corner

width Width of the visible area of the model

height height of the visible area of the model

SetTextColor

Define the color used to display text. It will be expressed in RGB components. It may
establish before the creation of the first page and its value will be remembered for the rest
from the document.

See SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell().


Argumentos Descripción
red Indicate the level of red. It is a value between 0 and 255.

green Indicate the level of green. It is a value between 0 and 255.

blue Indicate the level of blue. It is a value between 0 and 255.

SetTitle

Define the title of the document.

Ver : SetAuthor(), SetCreator(), SetKeywords(), SetSubject().


Argumentos Descripción
title Document Title

SetTopMargin

58
J. Sánchez. wxPdfCOM. Reference Manual

Define the upper margin. This method can be called before creating the first page and
it retains its value until new changes.

See SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins().


Argumentos Descripción
margin Upper margin

SetX

Define the abscissa of the current position. If the value of the argument is negative, it is understood
referred to the far right of the page.

GetX(), GetY(), SetY(), SetXY().


Argumentos Descripción
x Value of the abscissa of the current position

SetXY

Define the abscissa and the ordinate of the current position. If the value of x is negative, it
understood in relation to the far right of the page. If the value of y is negative, it will be understood
related to the bottom edge of the page.

See: SetX(), SetY().


Argumentos Descripción
x Value of the abscissa
y Value of the ordinate

SetY

Move the x-axis to the left margin and adjust the y-axis to the value of the argument. If the
the value of y is negative, understood relative to the bottom part of the page.

GetX(), GetY(), SetY(), SetXY().


Argumentos Descripción
y Value of the ordinate of the current position

Shape

Draw a shape that has been defined. The identifier of a shape is the name.
assigned during its definition.
Argumentos Descripción
shape Name assigned to the form

59
J. Sánchez. wxPdfCOM. Reference Manual

Drawing style. One of the following or one


style
valid combination.
+ PDF_STYLE_DRAW

+ PDF_STYLE_FILL

+ PDF_STYLE_FILLDRAW

Close the path and draw, combinable with


PDF_STYLE_FILL

ShapeCurveTo

Add a Bezier curve to a shape. The curve extends from the current position to
the point (x3,y3) using (x1,y1) and (x2,y2) as control points. The position of
The pointer of the shape is located at the point (x3,y3).
Argumentos Descripción
name Assigned name to the form

x1 Abscissa of control point 1

y1 Ordered from checkpoint 1

x2 Abscissa of control point 2

y2 Ordered from checkpoint 2

x3 Abscissa of the destination point

y3 Ordered from the destination point

ShapedText

Print text along a path defined by a shape. Depending on the


length of the text and form, it is possible to define several modes of visualization: Text is
show only once, text stretched to the length of the shape or text repeated along
the shape.
Argumentos Descripción
shape Name of the form

text Text to print

mode Mode: View next options

60
J. Sánchez. wxPdfCOM. Reference manual

PDF_SHAPEDTEXTMODE_ONETIME : Once
PDF_SHAPEDTEXTMODE_STRETCHTOFIT
Stretched along the shape
:
PDF_SHAPEDTEXTMODE_REPEAT : Repeated

ShapeLineto

Add a line to a shape. The line starts from the current position of the shape to the
Supplied point. The current position of the shape moves to the new point.
Argumentos Descripción
shape Name of a Shape object (New or existing)

x Abscissa of the point

y Ordered from the point

ShapeMoveto

Define a new point for a shape. If the shape has not been defined previously, it
it will be created with the given name in this function and this point will be set as the starting point of the new one
shape.
Argumentos Descripción
shape Name of a Shape object (New or existing)

x Abscissa of the point

y Ordered from the point

Scale

Modify the scale in the X and Y directions. The transformation is applied in a way
independent for each dimension.
Argumentos Descripción
sx Width scaling factor. Zero is not allowed.

sy Height scaling factor. Zero is not allowed.

x Abscissa of the scaling center

y Ordered from the scaling center

61
J.Sánchez. wxPdfCOM. Reference Manual

Skew

Produce a slope in the x and y directions.


Argumentos Descripción
Angle expressed in degrees between -90 (left inclination) and +90
xAngle
right
yAngle Angle expressed in degrees between -90 (downward inclination) and +90 (upward)

x Abscissa of the inclination axis

y Ordered from the axis of inclination

SkewX

Produce a tilt in the direction of x.


Argumentos Descripción
Angle expressed in degrees between -90 (left inclination) and +90
xAngle
(right)
x Abscissa of the inclination axis

y Ordered from the axis of inclination

SkewY

Produce a tilt in the direction of y.


Argumentos Descripción
yAngle Angle expressed in degrees between -90 (inclination down) and +90 (up)

x Abscissa of the inclination axis

y Ordered from the axis of inclination

StartTransform

Enter a transformation environment. This method should be invoked before applying


transformations. All transformation methods invoke this method in a way
implicitly if necessary. The initial state is automatically restored at the end of
page. No arguments needed.

See: StopTransform().

StopTransform

62
J. Sánchez. wxPdfCOM. Reference Manual

Leave the transformation context. Restore the saved graphic values with the
last call to StartTransform(). This method must be invoked to cancel an environment
transformation started with StartTransform. All transformation environments are
They implicitly close with the end of the page. No arguments needed.

Text

Print a string of characters at an exact location. The supplied point will determine the
left base of the first character of the string. The other functions to print text
Cell(), MultiCell() or Write() are more powerful and effective, so it is recommended to use them.
Text() only when it is necessary to precisely control the insertion point of it.

See: SetFont(), SetTextColor(), Cell(), MultiCell(), Write().


Argumentos Descripción
x Abscissa of the origin

y Ordered from the origin

txt Text to print

TextBox

This method counts the number of lines that the text occupies for a maximum width.
Argumentos Descripción
w Cell width. If it is zero, it takes the entire available width

h Cell height

txt Text to print


It allows you to center or align the text. It accepts the following values:

PDF_ALIGN_LEFT
halign
PDF_ALIGN_CENTER
PDF_ALIGN_RIGHT
PDF_ALIGN_JUSTIFY
Control the vertical alignment. Accepts the following values
PDF_ALIGN_TOP
valign
ALIGN_MIDDLE
PDF_ALIGN_BOTTOM
Indicate which edges will be drawn. Accept the values.
next.((+)Cumulative)
border PDF_BORDER_NONE
PDF_BORDER_LEFT
+ PDF_BORDER_RIGHT

63
J. Sánchez. wxPdfCOM. Reference Manual

+ PDF_BORDER_TOP
+ PDF_BORDER_BOTTOM
PDF_BORDER_FRAME
fill Valor lógico de relleno. 1 Verdadero, 0 Falso

TextField

Add a text field in the current position. The field will be part of the Acroform.
Argumentos Descripción
name Field name

width Text field width

height Field height

value Default value for the field

multiline Determine if the field will have multiple lines

Translate

Move the origin relative to the current position.


Argumentos Descripción
tx Move to the right
thank you Downward movement

TranslateX

Move the abscissa relative to the current position


Argumentos Descripción
tx Movement to the right

TranslateY

Move the order with respect to the current position.


Argumentos Descripción
ty Downward movement

UnsetClipping

Remove the mask area. After working with masks, they need to be removed with a
call to UnsetClipping(). It has no arguments.

64
J.Sánchez. wxPdfCOM. Reference Manual

Use Template

Use a model on the current page or in another model. It is used as if it were a


image. If set to zero, the width and height are determined by an internal call to
GetTemplateSize() or by the values passed to BeginTemplate(). The model may remain
distorted if the supplied dimensions do not correspond to the actual ones
model.

See: BeginTemplate(), EndTemplate(), ImportPage()


Argumentos Descripción
templateId Valid model identifier

x Abscissa of the position

y Ordered from the position

width Width

height High

Write

Print text at the current position. When the right margin is reached or found
with a newline character ( ), Write jumps to the beginning of the next line. It can be
create a link with Write. The position is fixed at the end of the displayed text.

See: SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak()


Argumentos Descripción
h Height of the line

txt Text to display

link Link

WriteCell

This method prints text with cell attributes at the current position. It causes a jump of
line when the right margin is reached or the character is found. The printing
continue on the right margin of the next line. after displaying the text the position
It is established at the end of it. A link can be created.

See: SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak()


Argumentos Descripción

65
J.Sánchez. wxPdfCOM. Reference manual

h Height of the line


Text to print
txt
Edge. There are the following (Cumulative)
PDF_BORDER_NONE
+ PDF_BORDER_LEFT
border + PDF_BORDER_RIGHT
PDF_BORDER_TOP
+ PDF_BORDER_BOTTOM
PDF_BORDER_FRAME
fill Filling
link Link

WriteXML

Print a text with HTML tags.


The printing starts at the current position.
Argumentos Descripción
str String of text with HTML tags

66
J. Sánchez. wxPdfCOM. Reference Manual

Annexes

Alphabetical list of instructions


Nombre Descripción
Accept Page Break Control the page break

AddFont Import TrueType, TrueTypeUnicode or Type1 fonts

AddFontCJK Import a CJK font (Chinese, Japanese, (K)Korean)

AddLink Create an internal link

AddPage Add a new page to the document

AppendJavaScript Add JavaScript code

Arrow Draw an arrow

AxialGradient Define a shading with axial gradient

BeginTemplate Mark the start of a model or template.

BookMark Add an index entry

Cell Draw a framed text with various options

CheckBox Añade un campo tipo Check al formulario

ClippedCell Draw a cell with a cutout

ClippingEllipse Define a mask in the shape of an ellipse

Clipping Path Define a mask in the shape of a Shape object

ClippingPolygon Define a polygon as a framed area.

ClippingRect Define a rectangular framing area

ClippingText Define a text as a mask

CloseFile Close the document

ClosePath It is used to draw a text.

67
J.Sánchez. wxPdfCOM. Reference manual

ComboBox It is used to draw a text.

Convert to Roman Convert an integer to Roman numerals

Curve Draw a Bezier curve


Draw a Bezier curve using the current point
CurveTo
output
DrawCircle Draw a circle

Ellipse Draw an ellipse


Complete the construction of a template. Return its
EndTemplate
identificador
Footer Control the footer recording

GetBreakMargin Return the margin for the page break

GetCellMargin Returns the cell margin

GetFontFamily Returns the name of the current font family

GetFontPath Return the path of the fonts folder

GetFontSize Returns the size in points of the current font

GetFontStyle Return the font style


Returns the activation state of partial inclusion of
GetFontSubsetting
Unicode sources
GetImageScale Return the scale of the image

GetLeftMargin Return the left margin

GetLineHeight Returns the height of the text line

GetLineWidth Returns the current line width

GetPageHeight Returns the height of the page

GetPageWidth Returns the current page width

GetRightMargin Return the right margin

GetScaleFactor Return the scaling factor

68
J. Sánchez. wxPdfCOM. Reference manual

GetStringWidth Returns the length of a string.

GetTemplateBBox Get the dimensions of an external template

GetTemplateSize Get the width and the height of a template

GetTopMargin Return the top margin

GetX Return the abscissa of the current position

GetY Return the ordinate of the current position

HEADER Control the recording of the header page

Image Show an image

ImageMask Prepare an image for use as a mask.

ImportPage Import a page from an external PDF document


Create a justified paragraph based on the content of a
ImportText
text file
Initialize Initialize the document

Lin Draw a line between two points

LineCount Count the number of lines that a text would take.

Ln Causes line breaks of variable height

Marker Draw a mark

MirrorH Create a horizontal mirror.

MirrorV Create a vertical reflection

MoveTo Reposition the drawing pointer

MultiCell Print a text on several lines

OpenPdf Start the generation of a PDF document

PageNo Return the current page number

Polygon Draw a polygon

69
J.Sánchez. wxPdfCOM. Reference manual

PushButton Create a form button

RadioButton Create a radio button in the current position

Rect Draw a rectangle

RegularPolygon Draw a regular polygon. Inscribed circle optional.

Rotate Activate the rotation of the graphics output.

RotatedImage Show an image with rotation

RotatedText Show a text with rotation


Show a rectangle with some or all of its corners
RoundedRect
rounded
SaveAsFile Save the document to a disk file

Scale Show an image with rotation

ScaleX Show a text with rotation


Show a rectangle with some or all of its corners
ScaleXY
rounded
ScaleY Save the document to a disk file

Sector Draw a sector

SetAlpha Set values for Alpha and for BlendMode


Establish a previously defined Alpha state with
SetAlphaState
SetAlpha()
Set Author Define the author of the document
Set the automatic page jump state like this
SetAutoPageBreak
like the bottom margin
SetCellMargin Set the margin for the cells

SetCompression Enable/Disable page compression

SetDrawColor Set the color for the drawing brush


Establish the name of the application that has been created by the
SetCreator
document
Set the initial display options of the
SetDisplaymode
document

70
J. Sánchez. wxPdfCOM. Reference Manual

SetFillColor Set the color for fill operations

SetFillGradient Draw a rectangular area with a color gradient


Indiscriminately establish the typeface, the style, and the
SetFont
size
SetFontPath Set the path to search for the font files

SetFontSize Set font size


Enable or disable partial embedding of TrueType fonts.
Set Font Subsetting
Unicode
SetFormBorderStyle Sets the border style of the form fields

SetImageScale Set the image scale

SetKeywords Define the keywords of the document

SetLeftMargin Set the left margin


Indiscriminately sets the font type, style, and the
SetLineHeight
size
SetLineWidth Set the line width

SetLink Define the page and the position to which a link points.

SetMargins Set the top, left, and right margins

SetProtection Enable the permissions and keys of the document

SetRightMargin Set the right margin


Establish an external document to use it as
SetSourceFile
template
SetSubject Establish the subject of the document
Define the visible sector of a model. It will be an area.
SetTemplateBBox
rectangular
SetTextColor Define the color used to display text

SetTitle Define the title of the document.

Set Top Margin Define the upper margin

SetX Define the abscissa of the current position

71
J.Sánchez. wxPdfCOM. Reference Manual

SetXY Define the abscissa and the ordinate of the current position

Move the x-axis to the left margin and adjust the y-axis.
SetY to the value of the argument

Shape Draw a shape that has been defined.

ShapeCurveTo Add a Bezier curve to a shape.


Print a text along a path defined by a
ShapedText
form
ShapeLineto Add a straight line to a shape

ShapeMoveto Define a new point for a shape

Scale Modify the scale in the X and Y directions.

Skew Create a slope in the x and y directions.

SkewX Produce a slope in the direction of x.

SkewY Tilt in the direction of y.

StartTransform Enter into a transformation environment.

StopTransform Abandon the context of transformation.

Text Print a string of characters in an exact place.


This method counts the number of lines that the text occupies.
TextBox
for a maximum width.
TextField Add a text field in the current position.

Translate Move the origin relative to the current position.

TranslateX Mueve la abscisa relativamente a la posición actual

TranslateY Move the order relative to the current position.

Unset Clipping Remove the mask area.

UseTemplate Use a model on the current page or in another model.

Write Print text at the current position.


This method prints text with cell attributes in the
WriteCell
current position.

72
J.Sánchez. wxPdfCOM. Reference manual

WriteXML Print a text with HTML tags.

73
J.Sánchez. wxPdfCOM. Reference Manual

Tables

Guiding values of the paper


PORTRAIT 1
LANDSCAPE 2

Constants for defining the border of Cell


PDF_BORDER_NONE 0
PDF_BORDER_LEFT 1
PDF_BORDER_RIGHT 2
PDF_BORDER_TOP 4
PDF_BORDER_BOTTOM 8
PDF_BORDER_FRAME 15

Alignment options
PDF_ALIGN_LEFT 0
PDF_ALIGN_CENTER 1
PDF_ALIGN_RIGHT 2
PDF_ALIGN_JUSTIFY 3
PDF_ALIGN_TOP 0
PDF_ALIGN_MIDDLE 1
PDF_ALIGN_BOTTOM 2

Options for the Cell Ln argument


NO 0
LN 1
LN2 2

Style options
PDF_STYLE_NOOP 0
PDF_STYLE_DRAW 1
PDF_STYLE_FILL 2
PDF_STYLE_FILLDRAW 3
PDF_STYLE_DRAWCLOSE 4
PDF_STYLE_MASK 7

Forms accepted by the Marker method


PDF_MARKER_CIRCLE 0
PDF_MARKER_SQUARE 1
PDF_MARKER_TRIANGLE_UP 2
PDF_MARKER_TRIANGLE_DOWN 3
PDF_MARKER_TRIANGLE_LEFT 4
PDF_MARKER_TRIANGLE_RIGHT 5
PDF_MARKER_MARKER_DIAMOND 6

74
J. Sánchez. wxPdfCOM. Reference Manual

PDF_MARKER_PENTAGON_UP 7
PDF_MARKER_PENTAGON_DOWN 8
PDF_MARKER_PENTAGON_LEFT 9
PDF_MARKER_PENTAGON_RIGHT 10
PDF_MARKER_STAR 11
PDF_MARKER_STAR4 12
PDF_MARKER_PLUS 13
PDF_MARKER_CROSS 14
PDF_MARKER_SUN 15
PDF_MARKER_BOWTIE_HORIZONTAL 16
PDF_MARKER_BOWTIE_VERTICAL 17
PDF_MARKER_MARKER_ASTERISK 18
PDF_MARKER_MARKER_LAST 19

Values for BlendMode


PDF_BLENDMODE_NORMAL 0
PDF_BLENDMODE_MULTIPLY 1
PDF_BLENDMODE_SCREEN 2
PDF_BLENDMODE_OVERLAY 3
PDF_BLENDMODE_DARKEN 4
PDF_BLENDMODE_LIGHTEN 5
PDF_BLENDMODE_COLORDODGE 6
PDF_BLENDMODE_COLORBURN 7
PDF_BLENDMODE_HARDLIGHT 8
PDF_BLENDMODE_SOFTLIGHT 9
PDF_BLENDMODE_DIFFERENCE 10
PDF_BLENDMODE_EXCLUSION 11
PDF_BLENDMODE_HUE 12
PDF_BLENDMODE_SATURATION 13
PDF_BLENDMODE_COLOR 14
PDF_BLENDMODE_LUMINOSITY 15

Zoom Values
PDF_ZOOM_FULLPAGE 0
PDF_ZOOM_FULLWIDTH 1
PDF_ZOOM_REAL 2
PDF_ZOOM_DEFAULT 3
PDF_ZOOM_FACTOR 4

Page presentation options


CONTINUOUS 0
PDF_LAYOUT_SINGLE 1
PDF_LAYOUT_TWO 2
PDF_LAYOUT_DEFAULT 3

75
J. Sánchez. wxPdfCOM. Reference manual

Types of permission for the document


PDF_PERMISSION_NONE 0
PDF_PERMISSION_PRINT 4
PDF_PERMISSION_MODIFY 8
PDF_PERMISSION_COPY 16
PDF_PERMISSION_ANNOT 32
PDF_PERMISSION_ALL 60

Encryption methods
PDF_ENCRYPTION_RC4V1 0
PDF_ENCRYPTION_RC4V2 1
PDF_ENCRYPTION_AESV2 2

Types of paper
PAPER_NONE 0 Undefined
PAPER_LETTER 1 Letter, 8 1/2 x 11 inches
LEGAL_DOCUMENT 2 Legal, 8 1/2 x 14 inches
A4 PAPER 3 A4 sheets, 210 x 297 millimeters
PAPER_CSHEET 4 C Folio, 17 x 22 inches
PAPER_DSHEET 5 D Folio, 22 x 34 inches
PAPER_ESHEET 6 E Folio, 34 x 44 inches
PAPER_LETTERSMALL 7 Small letter, 8 1/2 x 11 inches
PAPER_TABLOID 8 Tabloid, 11 x 17 inches
PAPER_LEDGER 9 Ledger, 17 x 11 inches
PAPER STATEMENT 10 Statement, 5 1/2 x 8 1/2 inches
PAPER_EXECUTIVE 11 Executive, 7 1/4 x 10 1/2 inches
PAPER_A3 12 A3 Folio, 297 x 420 millimeters
PAPER_A4SMALL 13 A4 small Folio, 210 x 297 millimeters
PAPER_A5 14 A5 Folio, 148 x 210 millimeters
PAPER_B4 15 B4 Folio, 250 x 354 millimeters
PAPER_B5 16 B5 Folio, 182 x 257 millimeters
PAPER_FOLIO 17 Folio, 8 1/2 x 13 inches
QUARTO PAPER 18 quarto, 215x275 millimeters
PAPER_10X14 19 Folio 10 x 14 inches
PAPER_11X17 20 sheets 11 x 17 inches
PAPER_NOTE 21 Note, 8 1/2 x 11 inches
PAPER_ENV_9 22 About #9, 3 7/8 x 8 7/8 inches
PAPER_ENV_10 23 On #10, 4 1/8 x 9 1/2 inches
PAPER_ENV_11 24 On #11, 4 1/2 x 10 3/8 inches
PAPER_ENV_12 25 About #12, 4 3/4 x 11 inches
PAPER_ENV_14 26 About '#14, 5 x 11 1/2 inches
PAPER_ENV_DL 27 On DL, 110 x 220 millimeters
PAPER_ENV_C5 28 On C5, 162 x 229 millimeters
PAPER_ENV_C3 29 On C3, 324 x 458 millimeters
PAPER_ENV_C4 30 On C4, 229 x 324 millimeters

76
J. Sánchez. wxPdfCOM. Reference Manual

PAPER_ENV_C6 31 On C6, 114 x 162 millimeters


PAPER_ENV_C65 32 On C65, 114 x 229 millimeters
PAPER_ENV_B4 33 About B4, 250 x 353 millimeters
PAPER_ENV_B5 34 On B5, 176 x 250 millimeters
PAPER_ENV_B6 35 On B6, 176 x 125 millimeters
PAPER_ENV_ITALY 36 About Italy, 110 x 230 millimeters
PAPER_ENV_MONARCH 37 'About Monarch, 3 7/8 x 7 1/2 inches
PAPER_ENV_PERSONAL 38 over 6 3/4, 3 5/8 x 6 1/2 inches
PAPER_FANFOLD_US 39 USA Std Fanfold, 14 7/8 x 11 inches
PAPER_FANFOLD_STD_GERMAN 40 German Std Fanfold, 8 1/2 x 12 inches
PAPER_FANFOLD_LGL_GERMAN 41 German Legal Fanfold, 8 1/2 x 13 inches
PAPER_ISO_B4 42 B4 (ISO) 250 x 353 mm
PAPER_JAPANESE_POSTCARD 43 Japanese Postcard 100 x 148 mm
PAPER_9X11 44 9 x 11 inches
PAPER_10X11 45 10 x 11 inches
PAPER_15X11 46 15 x 11 inches
PAPER_ENV_INVITE 47 About Invite 220 x 220 mm
PAPER_LETTER_EXTRA 48 Letter Extra 9 95 x 12 inches
LEGAL_EXTRA_PAPER 49 Legal Extra 9 \275 x 15 inches
PAPER_TABLOID_EXTRA 50 Extra Tabloid 11.69 x 18 inches
PAPER_A4_EXTRA 51 A4 Extra 9.27 x 12.69 inches
PAPER LETTER TRANSVERSE 52 Letter Transverse 8.275 x 11 inches
PAPER_A4_TRANSVERSE 53 A4 Transverse 210 x 297 mm
Letter Extra Transverse 54 9.275 x 12
CSR inches
PAPER_A_PLUS 55 SuperA/SuperA/A4 227 x 356 mm
PAPER_B_PLUS 56 SuperB/SuperB/A3 305 x 487 mm
PAPER_LETTER_PLUS 57 Letter Plus 8.5 x 12.69 inches
PAPER_A4_PLUS 58 A4 Plus 210 x 330 mm
PAPER_A5_TRANSVERSE 59 A5 Transverse 148 x 210 mm
PAPER B5 TRANSVERSE 60 B5 (JIS) Transverse 182 x 257 mm
PAPER_A3_EXTRA 61 A3 Extra 322 x 445 mm
PAPER_A5_EXTRA 62 A5 Extra 174 x 235 mm
PAPER_B5_EXTRA 63 B5 (ISO) Extra 201 x 276 mm
PAPER_A2 64 A2 420 x 594 mm
PAPER_A3_TRANSVERSE 65 A3 Transverse 297 x 420 mm
PAPER_A3_EXTRA_TRANSVERSE 66 A3 Extra Transverse 322 x 445 mm
PAPER_DBL_JAPANESE_POSTCARD 67 Japanese Double Postcard 200 x 148 mm
PAPER_A6 68 A6 105 x 148 mm
PAPER_JENV_KAKU2 69 Japanese Envelope Kaku #2
PAPER_JENV_KAKU3 70 Japanese Envelope Kaku #3
PAPER_JENV_CHOU3 71 Japanese Envelope Chou #3
PAPER_JENV_CHOU4 72 Japanese Envelope Chou #4
PAPER_LETTER_ROTATED 73 Letter Rotated 11 x 8 1/2 in
PAPER_A3_ROTATED 74 A3 Rotated 420 x 297 mm

77
J. Sánchez. wxPdfCOM. Reference Manual

PAPER_A4_ROTATED 75 A4 Rotated 297 x 210 mm


PAPER_A5_ROTATED 76 A5 Rotated 210 x 148 mm
PAPER_B4_JIS_ROTATED 77 B4 (JIS) Rotated 364 x 257 mm
PAPER_B5_JIS_ROTATED 78 B5 (JIS) Rotated 257 x 182 mm
PAPER_JAPANESE_POSTCARD_ROT 79 Japanese Postcard Rotated 148 x 100
ATED
mm
PAPER_DBL_JAPANESE_POSTCARD 80 Double Japanese Postcard Rotated 148 x
_ROTATED 200 mm
PAPER_A6_ROTATED 81 A6 Rotated 148 x 105 mm
PAPER_JENV_KAKU2_ROTATED 82 Japanese Envelope Kaku #2 Rotated
PAPER_JENV_KAKU3_ROTATED 83 Japanese Envelope Kaku #3 Rotated
PAPER_JENV_CHOU3_ROTATED 84 Japanese Envelope Chou #3 Rotated
PAPER_JENV_CHOU4_ROTATED 85 Japanese Envelope Chou #4 Rotated
PAPER_B6_JIS 86 B6 (JIS) 128 x 182 mm
PAPER_B6_JIS_ROTATED 87 B6 (JIS) Rotated 182 x 128 mm
PAPER_12X11 88 12 x 11 inches
PAPER_JENV_YOU4 89 Japanese Envelope You #4
PAPER_JENV_YOU4_ROTATED 90 Japanese Envelope You #4 Rotated
PAPER_P16K 91 PRC 16K 146 x 215 mm
PAPER_P32K 92 PRC 32K 97 x 151 mm
PAPER_P32KBIG 93 PRC 32K(Big) 97 x 151 mm
PAPER_PENV_1 94 PRC Envelope #1 102 x 165 mm
PAPER_PENV_2 95 PRC Envelope #2 102 x 176 mm
PAPER_PENV_3 96 PRC Envelope #3 125 x 176 mm
PAPER_PENV_4 97 PRC Envelope #4 110 x 208 mm
PAPER_PENV_5 98 PRC Envelope #5 110 x 220 mm
PAPER_PENV_6 99 PRC Envelope #6 120 x 230 mm
PAPER_PENV_7 100 PRC Envelope #7 160 x 230 mm
PAPER_PENV_8 101 PRC Envelope #8 120 x 309 mm
PAPER_PENV_9 102 PRC Envelope #9 229 x 324 mm
PAPER_PENV_10 103 PRC Envelope #10 324 x 458 mm
PAPER_P16K_ROTATED 104 PRC 16K Rotated
PAPER_P32K_ROTATED 105 PRC 32K Rotated
PAPER_P32KBIG_ROTATED 106 PRC 32K(Big) Rotated
PAPER_PENV_1_ROTATED 107 PRC Envelope #1 Rotated 165 x 102 mm
PAPER_PENV_2_ROTATED 108 PRC Envelope #2 Rotated 176 x 102 mm
PAPER_PENV_3_ROTATED 109 PRC Envelope #3 Rotated 176 x 125 mm
PAPER_PENV_4_ROTATED 110 PRC Envelope #4 Rotated 208 x 110 mm
PAPER_PENV_5_ROTATED 112 PRC Envelope #5 Rotated 220 x 110 mm
PAPER_PENV_6_ROTATED 113 PRC Envelope #6 Rotated 230 x 120 mm
PAPER_PENV_7_ROTATED 114 PRC Envelope #7 Rotated 230 x 160 mm
PAPER_PENV_8_ROTATED 115 PRC Envelope #8 Rotated 309 x 120 mm
PAPER_PENV_9_ROTATED 116 PRC Envelope #9 Rotated 324 x 229 mm
PAPER_PENV_10_ROTATED 117 PRC Envelope #10 Rotated 458 x 324 m

78
J. Sánchez. wxPdfCOM. Reference Manual

Introduction
FPDF......................................................................................................................................2
COM.......................................................................................................................................4
Advantages and disadvantages
Setting up the environment......................................................................................................6
Register the component.....................................................................................................6
Constants file ......................................................................................................... 7
Declarando variables...........................................................................................................7
Assigning memory.............................................................................................................8
Communicating with wxPdfCOM...........................................................................................8
User Manual...............................................................................................................9
General considerations
Passing of arguments............................................................................................................9
Passing arrays......................................................................................................................9
Cumulative arguments.................................................................................................10
Define the document format.....................................................................................12
Document properties.............................................................................................12
Headers and footers.............................................................................................12
Print texts....................................................................................................................13
Graphics................................................................................................................................17
Reference of instructions ..................................................................................21
Annexes ..............................................................................67
Alphabetical list of instructions.................................67
Tables 74
Index ………………………………………………………………………79

79

You might also like