Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.WriteFText
Writes text on current page with formatting commands.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
Align | The text alignment. Can be left, center, right or justify. | "left" | |
Text | The text to write. | "Hello World" | |
PlainText | Available in MBS FileMaker Plugin 9.1 or newer. Pass 1 to ignore formatting commands and treat text as plain text. Default is 0 to interpret commands in text. |
0 | Optional |
Result
Returns OK or error message.
Description
Writes text on current page with formatting commands.Use DynaPDF.GetFTextHeightEx or DynaPDF.GetFTextHeight to calculate the space needed for the text if you want to create a matching text rectangle for vertical alignment.
See DynaPDF.AllowPageBreak for whether to do page breaks or not.
Please set a font first with DynaPDF.SetFont function before you write on the page.
See DynaPDF.WriteStyledText and DynaPDF.WriteStyledTextEx to convert FileMaker styles to DynaPDF commands.
See also WriteFText function in DynaPDF manual.
Examples
Writes some text:
MBS( "DynaPDF.WriteFText"; $PDF; "center"; "Hello World" )
Write text with font changing:
# Write some formatted text
Set Variable [ $text ; Value: "Some text. \FT[Times-Bold]Now Times in bold!\FT[Times-Roman] and back to normal Times." ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetTextRect"; $pdf; 200; 200; 150; -1) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteFText"; $pdf; "left"; $text) ]
Write some text with a link:
MBS( "DynaPDF.WriteFText"; $PDF; "left"; "Link to DynaPDF: \FC[16711680]\ul#\LK[false, TRUE, false, https://www.dynaforms.com]Test\EK#\ul#\FC[0]." )
Measure text height and draw it aligned to bottom of page:
# get some styled text from FileMaker
Set Variable [ $StyledText ; Value: MyTable::MyText ]
If [ Length ( $StyledText ) > 0 ]
# Convert to the styles DynaPDF needs
Set Variable [ $text ; Value: MBS( "DynaPDF.ConvertStyledText"; $PDF; $StyledText; $LeadingFactor ) ]
# set a default font and color
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; "Helvetica"; 0; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
# calculate height for this block
Set Variable [ $height ; Value: MBS( "DynaPDF.GetFTextHeightEx"; $PDF; 240; "left"; $Text ) ]
# Set the area where the text is output based on height from bottom of page
Set Variable [ $r ; Value: MBS("DynaPDF.SetTextRect"; $pdf; 620; 28 + $height + $PositionOffset; 240; $height + 5) ]
# and draw it
Set Variable [ $r ; Value: MBS("DynaPDF.WriteFText"; $pdf; "left"; $text) ]
End If
Write text in CMYK colors:
# set colorspace
Set Variable [ $r ; Value: MBS("DynaPDF.SetColorSpace"; $pdf; "DeviceCMYK") ]
# calculate color values for CMYK
Set Variable [ $cyan ; Value: MBS( "DynaPDF.CMYK"; 255; 0; 0; 0 ) ]
Set Variable [ $magenta ; Value: MBS( "DynaPDF.CMYK"; 0; 255; 0; 0 ) ]
Set Variable [ $yellow ; Value: MBS( "DynaPDF.CMYK"; 0; 0; 255; 0 ) ]
Set Variable [ $black ; Value: MBS( "DynaPDF.CMYK"; 0; 0; 0; 255 ) ]
# now write some text
Set Variable [ $r ; Value: MBS("DynaPDF.SetTextRect"; $pdf; 100; 100; 500; 200) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteFText"; $pdf; "left"; "Testing: " &
"\FC[" & $cyan & "]Cyan" &
"\FC[" & $Magenta & "]Magenta" &
"\FC[" & $Yellow & "]Yellow" &
"\FC[" & $Black & "]Black" ) ]
Write text in RGB colors:
Set Variable [ $r ; Value: MBS("DynaPDF.SetColorSpace"; $pdf; "DeviceRGB") ]
# calculate color values for RBB
Set Variable [ $red ; Value: MBS( "DynaPDF.RGB"; 255; 0; 0 ) ]
Set Variable [ $green ; Value: MBS( "DynaPDF.RGB"; 0; 255; 0 ) ]
Set Variable [ $blue ; Value: MBS( "DynaPDF.RGB"; 0; 0; 255 ) ]
# now write some text
Set Variable [ $r ; Value: MBS("DynaPDF.SetTextRect"; $pdf; 100; 100; 500; 200) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteFText"; $pdf; "left"; "Testing: " &
"\FC[" & $red & "]Red" &
"\FC[" & $green & "]Green" &
"\FC[" & $blue & "]Blue" ) ]
See also
- DynaPDF.RoundRectEx
- DynaPDF.SetColorSpace
- DynaPDF.SetFillColor
- DynaPDF.SetPageBreakExpression
- DynaPDF.SetTabLen
- DynaPDF.WebLink
- DynaPDF.WriteDemoText
- DynaPDF.WriteFTextExRotated
- DynaPDF.WriteStyledText
- DynaPDF.WriteText
Release notes
- Version 9.1
- Added PlainText flag to DynaPDF.WriteFText, DynaPDF.WriteFTextEx and DynaPDF.WriteFTextExRotated functions.
- Version 7.4
Example Databases
- DynaPDF/Add Weblinks
- DynaPDF/Book Creation
- DynaPDF/Create Text as PDFA
- DynaPDF/Multi Column Output
- DynaPDF/Place Picture
- DynaPDF/Watermark pages
- DynaPDF/WriteFText
- DynaPDF/ZUGFeRD/ZUGFeRD Invoice
- DynaPDF/ZUGFeRD 2.0/Factur-X Invoice
- DynaPDF/ZUGFeRD 2.0/ZUGFeRD 2.0 Invoice
Blog Entries
- New in MBS FileMaker Plugin 11.0
- Neues MBS FileMaker Plugin 11.0
- MBS FileMaker Plugin 11.0 - More than 6400 Functions In One Plugin
- Multi Column Output for PDFs with FileMaker
- New in MBS FileMaker Plugin 10.5
- MBS FileMaker Plugin, version 10.5pr3
- DynaPDF WriteFText with links inside
- MBS FileMaker Plugin, version 9.1pr2
- DynaPDF and Styled Text, Xojo vs. FileMaker
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 3th March 2022