Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  


Replaces a text with a new text.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
DynaPDF 3.4 Yes Yes Yes Yes Yes

MBS( "DynaPDF.ReplacePattern"; PDF; Text; NewText { ; Alignment; NewFontSize; NewFontStyle; NewCharacterSpacing; NewTextScaling; NewTextRise } )


Parameter Description Example value
PDF The PDF reference returned from DynaPDF.New. $pdf
Text The text to search. "Hello"
NewText The text to replace the found location with. "World"
Alignment Optional
The new alignment you want. 0 = Left, 1 = Center and 2 = Right. May not work with rotated text.
NewFontSize Optional
The new font size to use. Use -1 to keep whatever it is. Due to matrix scaling in pdf, the size here may be far off.
NewFontStyle Optional
The new font style. Use -1 to keep whatever it is. e.g. 4 for underline, 2 for bold, 1 for italic or a combination. See dynapdf manual for more values for font styles.
NewCharacterSpacing Optional
The new character spacing value. See also DynaPDF.SetCharacterSpacing.
If undefined, keeps current character spacing.
NewTextScaling Optional
The text scaling to use.
NewTextRise Optional
The text rise to use.
In percent of text height as plugin multipies y by given factor.


Returns number of locations found.


Replaces a text with a new text.
You need to have an open page. you can use DynaPDF.EditPage to edit an existing one.


Replace placeholder with text:

MBS("DynaPDF.ReplacePattern"; $pdf; "<<PLZ Ort>>"; "56645 Nickenich")

Replace some texts with different alignment:

Variable setzen [ $r1 ; MBS("DynaPDF.ReplacePattern"; $pdf; "Hello1"; "Hello World"; 0) ]
Variable setzen [ $r2 ; MBS("DynaPDF.ReplacePattern"; $pdf; "Hello3"; "Hello World"; 1) ]
Variable setzen [ $r3 ; MBS("DynaPDF.ReplacePattern"; $pdf; "Hello5"; "Hello World"; 2) ]

Replace text, make it centered and underlined:

MBS("DynaPDF.ReplacePattern"; $pdf; "Hello3"; "Hello World"; 1; -1; 4)

See also

Example Databases

DynaPDF.RenderPage   -   DynaPDF.ResetEncryptionSettings

Feedback: Report problem or ask question.

MBS Xojo Plugins