PdfSetTextRect(x as double, y as double, w as double, h as double) As Boolean

 

The function defines the output rectangle that is used to output formatted text.

 

Text must be written with the function PdfWriteFText.

 

 

Parameters:

 

Name

Type

Description

x

Double

Position from Left in points

y

Double

Position from Top in points (If PdfSetPageCoordsTopDown is set)

Position from Bottom in points (If PdfSetPageCoordsBottomUp is set)

w

Double

Width of rectangle in points

h

Double

Height of rectangle in points

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True if the the TextRect has been set.

Returns False upon failure

 

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 '%PdfSetTextRect%'

 

Example XojoScript:

 

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

 

// Point of origin is top-left

PdfSetPageCoordsTopDown

 

// Define variables for position

Dim x,y As Double

 

// Set output font and color

PdfSetFont("Arial","Regular",10.0)

Call PdfSetFillColor("&c00000000") // black textcolor

 

// write a location and current date

x = 400.0

y = 30.0

Call PdfWriteText(x,y,"Basel, " + GetDateLocalized)

 

y = 100.0

 

// Define a TextRect (box) for text

Call PdfSetTextRect(x,y,200.0,-1)  // -1 = not breaking to next page

 

// Write text to the TextRect

Call PDFwriteFText("LEFT","Oliver Osswald" + eol + "Gruthweg 9" + eol + "4132 Muttenz")

 

// Finalize PDF

Call PdfCloseFile

 

// Open pdf in default pdf viewer

Call Pdflaunch

 

End If