PdfSetFont(fontName as string, Style As String, Size as double)

 

The function loads a font that can be used for text output.

 

You may want to use this function to set the fill color of a rectangle, as shown here:

 

If the font style is set to Style None the function searches the font first by full name,

then by postscript name, and finally by family name if the font was not already found.

 

 

Parameters:

 

Name

Type

Description

fontName

String

The name of the font to be loaded.

This can be either the full name, the postscript name or the family name of the font.

Example: Arial

Style

String

Possible values:

 

Black

Bold

Condensed

DemiBold

Expanded

ExtraBold

ExtraCondensed

ExtraExpanded

ExtraLight

Italic

Light

Medium

None

Normal

Regular

SemiCondensed

SemiExpanded

Striked

Thin

UltraBlack

UltraCondensed

UltraExpanded

Underlined

VerticalMode

 

 

Size

Double

Size of printed font in points as a floating point value, like 12.0

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Create Seminar Invoice With Slip As PDF

739DA58E-17EE-41CE-BB54-E7362CFE17D4

Create Seminar Invoice As PDF

2C3F7F29-A29A-4338-ACF5-51894B709DA5

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%PdfSetFont%'

 

Example XojoScript:

 

If PdfStart("testfile.pdf") > 0 Then

 

// Set top top-left as 0,0 coordinates

PdfSetPageCoordsTopDown

Dim x,y As Double = 30.0

 

// Set output font

PdfSetFont("Arial","Regular",20.0)

 

// Set Color

Call PdfSetFillColor("&cFF000000") // red textcolor

 

// write a location and current date

Call PdfWriteText(x,y,"Page 1")

 

// Finalize PDF

Call PdfcloseFile

 

// Open PDF in default viewer

Call Pdflaunch

 

End If