Write text into an existing
pdf object
Instead of printing text on a
line by line basis it is also possible to output text into a rectangle.
The function prints a
formatted text exactly in the same way as PdfWriteFText.
However, the function contains
already the parameters to set the output rectangle.
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, like: 200.0 |
h |
Double |
Height of text-rectangle in points. To avoid a page break set the parameter h
to -1.0 |
Align |
String |
Sets text alignment inside of the frame defined by x,y,w,h Align values: Left,
Center, Right,
Justify |
aText |
String |
Text to be drawn inside of the frame defined by x,y,w,h |
Returns:
Type |
Value |
Description |
Boolean |
True or
False |
Returns True if the text has been drawn. Returns False upon failure |
Available in:
WindowMain |
WindowLink |
YES |
YES |
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 '%PdfWriteFTextEx%'
Example XojoScript:
If
PdfStart("testfile.pdf")
> 0 Then
PdfSetPageCoordsTopDown
// Point of origin is top-left
PdfSetFont("Arial","Regular",10.0) // Set output
font
Call PdfSetFillColor("&c00000000")
// Set black textcolor
Dim x,y As Double = 30.0
// Define variables for text position
// Define a text
Dim address As String = "Oliver Osswald" + eol + "Gruthweg
9" + eol + "4132 Muttenz"
// Draw text to PDF
Call PDFwriteFTextEx(x,y,200.0,-1.0,"LEFT",
address)
// Finalize PDF
Call PdfCloseFile
// Open pdf in default
pdf viewer
Call Pdflaunch
End
If