PdfSetFillColor(tColor as String) As Boolean

 

The function sets the fill color.

 

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

 

 

 

Parameters:

 

Name

Type

Description

tColor

String

A hex string code for the color, like "&cF3BC1900"

 

The string code for a color can be copied from a Script Window. Select New Script Manager from menu Script.

 

Hold the cmd key and click on the color picker field to open a color picker:

 


 

 

After selection of a color, you can copy the hex-string from this field to your code.

 

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True if the color has been set.

Returns False upon failure

Raises an exception if current color space is CMYK or Gray and not RGB

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Create Seminar Invoice With Slip As PDF

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

 

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

 

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 and color

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

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

 

// write a location and current date

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

 

// Set fill color of rectangle

Call PdfSetFillColor("&cF3BC1900") // yellow

 

// Set frame color of rectangle

Call PdfSetStrokeColor("&c3F7DFFFF") // blue

 

// Fill the rectangle

Call PdfRectangle(x,60.0,300.0,50.0,"FILLSTROKE")

 

// Finalize PDF

Call PdfcloseFile

 

// Open PDF in default viewer

Call Pdflaunch

 

End If