Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Find and Replace Text

All examples are included with download of MBS FileMaker Plugin.

Find and Replace Text.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 13
Value Lists 0
Custom Functions 0
Custom Menus 33
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields Off
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
DynaPDF Replace Text
5 fields defined, 1 record
DynaPDF Replace Text

Fields

Table Name: DynaPDF Replace Text - 5 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
InputPDF Normal, Binary Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      OutputPDF Normal, Binary Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
          SearchText Normal, Text Auto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              ReplaceText Normal, Text Auto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  Result Normal, Text Auto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German

                        Layout Objects: DynaPDF Replace Text

                        Regular Fields

                        Field Name: DynaPDF Replace Text::InputPDF
                        Field Properties Coordinates Field Format Field Behavior Quick Find
                        • Top: 24 pt
                        • Left: 138 pt
                        • Bottom: 290 pt
                        • Right: 410 pt
                        • Anchoring: Left, Top
                        Field Format:
                        • Edit Box
                        Field Behavior:
                        • Allow field to be entered: In Find mode, In Browse mode
                        • Touch keyboard type: System Default
                        • Go to next field using: Tab key
                        No

                        Field Name: DynaPDF Replace Text::OutputPDF
                        Field Properties Coordinates Field Format Field Behavior Quick Find
                        • Top: 297 pt
                        • Left: 139 pt
                        • Bottom: 637 pt
                        • Right: 788 pt
                        • Anchoring: Left and Right, Top and Bottom
                        Field Format:
                        • Edit Box
                        Field Behavior:
                        • Allow field to be entered: In Find mode, In Browse mode
                        • Touch keyboard type: System Default
                        • Go to next field using: Tab key
                        No

                        Field Name: DynaPDF Replace Text::SearchText
                        Field Properties Coordinates Field Format Field Behavior Quick Find
                        • Top: 25 pt
                        • Left: 502 pt
                        • Bottom: 44 pt
                        • Right: 755 pt
                        • Anchoring: Left, Top
                        Field Format:
                        • Edit Box
                        Field Behavior:
                        • Allow field to be entered: In Find mode, In Browse mode
                        • Touch keyboard type: System Default
                        • Go to next field using: Tab key
                        Yes

                        Field Name: DynaPDF Replace Text::ReplaceText
                        Field Properties Coordinates Field Format Field Behavior Quick Find
                        • Top: 46 pt
                        • Left: 502 pt
                        • Bottom: 66 pt
                        • Right: 755 pt
                        • Anchoring: Left, Top
                        Field Format:
                        • Edit Box
                        Field Behavior:
                        • Allow field to be entered: In Find mode, In Browse mode
                        • Touch keyboard type: System Default
                        • Go to next field using: Tab key
                        Yes

                        Field Name: DynaPDF Replace Text::Result
                        Field Properties Coordinates Field Format Field Behavior Quick Find
                        • Top: 68 pt
                        • Left: 502 pt
                        • Bottom: 87 pt
                        • Right: 755 pt
                        • Anchoring: Left, Top
                        Field Format:
                        • Edit Box
                        Field Behavior:
                        • Allow field to be entered: In Find mode, In Browse mode
                        • Touch keyboard type: System Default
                        • Go to next field using: Tab key
                        Yes

                        Buttons

                        Button Properties Coordinates Script/Script Step
                          Type:
                        • Text: Import PDF
                        • Top: 215 pt
                        • Left: 436 pt
                        • Bottom: 249 pt
                        • Right: 580 pt
                        • Anchoring: Left, Top
                        Perform Script [ “Import PDF” ]

                        Scripts:


                        Button Properties Coordinates Script/Script Step
                          Type:
                        • Text: Export PDF
                        • Top: 256 pt
                        • Left: 436 pt
                        • Bottom: 290 pt
                        • Right: 580 pt
                        • Anchoring: Left, Top
                        Perform Script [ “Export PDF” ]

                        Scripts:


                        Button Properties Coordinates Script/Script Step
                          Type:
                        • Text: Find & Replace 1 Page
                        • Top: 645 pt
                        • Left: 138 pt
                        • Bottom: 679 pt
                        • Right: 282 pt
                        • Anchoring: Left, Bottom
                        Perform Script [ “Find and Replace Text one page” ]

                        Scripts:


                        Button Properties Coordinates Script/Script Step
                          Type:
                        • Text: Find & Replace All Pages
                        • Top: 645 pt
                        • Left: 296 pt
                        • Bottom: 679 pt
                        • Right: 482 pt
                        • Anchoring: Left, Bottom
                        Perform Script [ “Find and Replace Text all pages” ]

                        Scripts:


                        Script Hierarchy

                        InitDynaPDF
                        -
                        Find and Replace Text one page
                        Find and Replace Text all pages
                        Find Text and draw rectangles
                        Find Text and delete text
                        Delete Text
                        -
                        Import PDF
                        Export PDF
                        Clear
                        -
                        Delete All Images

                        Next Script: [-]
                        Script Name InitDynaPDF
                        Run script with full access privileges Off
                        Siri Shortcut Visible Off
                        Include In Menu Yes
                        Layouts that use this script
                          Scripts that use this script
                          Script Definition
                          Script Steps
                          • #Locate DynaPDF library
                          • #you can have libraries in container and export at runtime to folder of your choice.
                          • #Or install library somewhere and pass path.
                          • #If library is in same folder as plugin, you can only pass only file name.
                          • If [ MBS("IsServer") ]
                          • #Put the path you use for your server here:
                          • If [ Get(SystemPlatform) = -2 ]
                          • #Server on Windows
                          • Set Variable [ $path; Value:"C:\Programs\FileMaker Server\dynapdf.dll" ]
                          • Else If [ MBS("IsLinux") ]
                          • #Server on Linux for FileMaker Cloud
                          • Set Variable [ $path; Value:"/opt/FileMaker/FileMaker Server/dynapdf.linux.so" ]
                          • Else
                          • #Server on Mac
                          • Set Variable [ $path; Value: "/Library/FileMaker Server/dynapdf.dylib" ]
                          • End If
                          • Else
                          • #For desktop and our examples we look in same folder as database:
                          • Set Variable [ $databasePath; Value:Get(FilePath) ]
                          • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
                          • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
                          • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
                          • If [ Get(SystemPlatform) = -2 ]
                          • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                          • #plugin will look for dynapdf.dll and if not found also for dynapdf.dll (64-bit) and dynapdf32.dll (32-bit).
                          • Else
                          • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                          • #Mac dylib is usually 32 and 64 bit together.
                          • End If
                          • End If
                          • #You can test for free.
                          • #If you like to get a dynapdf license, please follow links on our pricing page:
                          • #https://www.monkeybreadsoftware.de/filemaker/pricing.shtml
                          • Set Variable [ $LicenseKey; Value:"Pro" // put your key here or leave empty for demo. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                          • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                          • If [ $r ≠ "OK" ]
                          • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                          • Halt Script
                          • End If
                          Fields used in this script
                            Scripts used in this script
                              Layouts used in this script
                                Tables used in this script
                                  Table occurrences used by this script
                                    Custom Functions used by this script
                                      Custom menu set used by this script

                                        Previous Script: [InitDynaPDF] Next Script: [Find and Replace Text one page]
                                        Script Name -
                                        Run script with full access privileges Off
                                        Siri Shortcut Visible Off
                                        Include In Menu Yes
                                        Layouts that use this script
                                          Scripts that use this script
                                            Script Definition
                                            Script Steps
                                              Fields used in this script
                                                Scripts used in this script
                                                  Layouts used in this script
                                                    Tables used in this script
                                                      Table occurrences used by this script
                                                        Custom Functions used by this script
                                                          Custom menu set used by this script

                                                            Previous Script: [-] Next Script: [Find and Replace Text all pages]
                                                            Script Name Find and Replace Text one page
                                                            Run script with full access privileges Off
                                                            Siri Shortcut Visible Off
                                                            Include In Menu Yes
                                                            Layouts that use this script
                                                            Scripts that use this script
                                                              Script Definition
                                                              Script Steps
                                                              • #Find Text in the page and replace with new text
                                                              • #Initialize DynaPDF if needed
                                                              • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                              • Perform Script [ “InitDynaPDF” ]
                                                              • End If
                                                              • #Clear current PDF document
                                                              • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                              • #Load PDF from container
                                                              • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                              • #import a page
                                                              • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1) ]
                                                              • #initialize parser
                                                              • Set Variable [ $OptimizeFlags; Value:0 ]
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.SetAltFont"; $pdf; "Helvetica"; 0; 12) ]
                                                              • #Now parse a page
                                                              • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; 1; "EnableTextSelection") ]
                                                              • If [ MBS("IsError") ]
                                                              • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                              • Else
                                                              • #Run a find
                                                              • Set Variable [ $continueFind; Value:0 ]
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                              • If [ $r = 1 ]
                                                              • Loop [ Flush: Always ]
                                                              • #Do the replace
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.ReplaceSelText"; $pdf; DynaPDF Replace Text::ReplaceText) ]
                                                              • #Continue search
                                                              • Set Variable [ $continueFind; Value:1 ]
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                              • Exit Loop If [ $r ≠ 1 ]
                                                              • End Loop
                                                              • #Save changes back
                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
                                                              • End If
                                                              • End If
                                                              • #save
                                                              • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                              • #Cleanup
                                                              • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                              Fields used in this script
                                                              Scripts used in this script
                                                              Layouts used in this script
                                                                Tables used in this script
                                                                Table occurrences used by this script
                                                                Custom Functions used by this script
                                                                  Custom menu set used by this script

                                                                    Previous Script: [Find and Replace Text one page] Next Script: [Find Text and draw rectangles]
                                                                    Script Name Find and Replace Text all pages
                                                                    Run script with full access privileges Off
                                                                    Siri Shortcut Visible Off
                                                                    Include In Menu Yes
                                                                    Layouts that use this script
                                                                    Scripts that use this script
                                                                      Script Definition
                                                                      Script Steps
                                                                      • #Find Text all pages and replace with new text
                                                                      • Set Variable [ $StartTime; Value:Get(CurrentTimeUTCMilliseconds) ]
                                                                      • #Initialize DynaPDF if needed
                                                                      • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                      • Perform Script [ “InitDynaPDF” ]
                                                                      • End If
                                                                      • #Clear current PDF document
                                                                      • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                      • #Load PDF from container
                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                                      • #import a page
                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
                                                                      • #initialize parser
                                                                      • Set Variable [ $OptimizeFlags; Value:0 ]
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.SetAltFont"; $pdf; "Helvetica"; 0; 12) ]
                                                                      • #loop counting up from 1 to $count
                                                                      • Set Variable [ $count; Value:MBS("DynaPDF.GetPageCount"; $pdf) ]
                                                                      • Set Variable [ $index; Value:1 ]
                                                                      • If [ $index ≤ $count ]
                                                                      • Loop [ Flush: Always ]
                                                                      • #your script steps here
                                                                      • #Now parse a page
                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; $index; "EnableTextSelection") ]
                                                                      • If [ MBS("IsError") ]
                                                                      • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Else
                                                                      • #Run a find
                                                                      • Set Variable [ $continueFind; Value:0 ]
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                      • If [ $r = 1 ]
                                                                      • Loop [ Flush: Always ]
                                                                      • #Do the replace
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.ReplaceSelText"; $pdf; DynaPDF Replace Text::ReplaceText) ]
                                                                      • #Continue search
                                                                      • Set Variable [ $continueFind; Value:1 ]
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                      • Exit Loop If [ $r ≠ 1 ]
                                                                      • End Loop
                                                                      • #Save changes back
                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
                                                                      • End If
                                                                      • End If
                                                                      • #next
                                                                      • Set Variable [ $index; Value:$index + 1 ]
                                                                      • Exit Loop If [ $index > $count ]
                                                                      • End Loop
                                                                      • End If
                                                                      • #save
                                                                      • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                                      • Set Variable [ $EndTime; Value:Get(CurrentTimeUTCMilliseconds) ]
                                                                      • Show Custom Dialog [ Title: "Time"; Message: ($EndTime - $StartTime); Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                      • #Cleanup
                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                      Fields used in this script
                                                                      Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                        Table occurrences used by this script
                                                                        Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [Find and Replace Text all pages] Next Script: [Find Text and delete text]
                                                                            Script Name Find Text and draw rectangles
                                                                            Run script with full access privileges Off
                                                                            Siri Shortcut Visible Off
                                                                            Include In Menu Yes
                                                                            Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                • #Find text and draw rectangles on their position
                                                                                • #Initialize DynaPDF if needed
                                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                • Perform Script [ “InitDynaPDF” ]
                                                                                • End If
                                                                                • #Clear current PDF document
                                                                                • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                • #Load PDF from container
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                                                • #import a page
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1) ]
                                                                                • #initialize parser
                                                                                • Set Variable [ $OptimizeFlags; Value:0 ]
                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.SetAltFont"; $pdf; "Helvetica"; 0; 12) ]
                                                                                • #We collect positions in a quicklist
                                                                                • Set Variable [ $list; Value:MBS("QuickList.New") ]
                                                                                • Set Variable [ $page; Value:1 ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") // parser delivers top down coordinates ]
                                                                                • #Now parse a page
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; $page; "EnableTextSelection") ]
                                                                                • If [ MBS("IsError") ]
                                                                                • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                • Else
                                                                                • #Run a find
                                                                                • Set Variable [ $continueFind; Value:0 ]
                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                                • If [ $r = 1 ]
                                                                                • Loop [ Flush: Defer ]
                                                                                • #store positions for later
                                                                                • Set Variable [ $rectangle; Value:MBS( "DynaPDF.Parser.SelectionBBox"; $pdf ) ]
                                                                                • Set Variable [ $r; Value:MBS("QuickList.Push"; $list; $rectangle) ]
                                                                                • #Continue search
                                                                                • Set Variable [ $continueFind; Value:1 ]
                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                                • Exit Loop If [ $r ≠ 1 ]
                                                                                • End Loop
                                                                                • End If
                                                                                • End If
                                                                                • #now edit page and draw the rectangles
                                                                                • If [ MBS("QuickList.Count"; $list) > 0 ]
                                                                                • If [ MBS("DynaPDF.EditPage"; $pdf; $page) = "OK" ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetUseVisibleCoords"; $pdf; 1) // just in case crop box is used ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetLineWidth"; $pdf; 1) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetOrientationEx"; $pdf; MBS("DynaPDF.GetOrientation"; $pdf)) // rotate coordinate system as needed ]
                                                                                • Loop [ Flush: Defer ]
                                                                                • Set Variable [ $rectangle; Value:MBS("QuickList.Pop"; $list) ]
                                                                                • Set Variable [ $x1; Value:GetAsNumber(GetValue($rectangle; 1)) ]
                                                                                • Set Variable [ $y1; Value:GetAsNumber(GetValue($rectangle; 2)) ]
                                                                                • Set Variable [ $x2; Value:GetAsNumber(GetValue($rectangle; 3)) ]
                                                                                • Set Variable [ $y2; Value:GetAsNumber(GetValue($rectangle; 4)) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Rectangle"; $pdf; $x1; $y1; $x2-$x1; $y2-$y1; "stroke") ]
                                                                                • Exit Loop If [ MBS("QuickList.Count"; $list) < 1 ]
                                                                                • End Loop
                                                                                • End If
                                                                                • End If
                                                                                • Set Variable [ $r; Value:MBS("QuickList.Free"; $list) ]
                                                                                • #save
                                                                                • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                                                • #Cleanup
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                Fields used in this script
                                                                                Scripts used in this script
                                                                                Layouts used in this script
                                                                                  Tables used in this script
                                                                                  Table occurrences used by this script
                                                                                  Custom Functions used by this script
                                                                                    Custom menu set used by this script

                                                                                      Previous Script: [Find Text and draw rectangles] Next Script: [Delete Text]
                                                                                      Script Name Find Text and delete text
                                                                                      Run script with full access privileges Off
                                                                                      Siri Shortcut Visible Off
                                                                                      Include In Menu Yes
                                                                                      Layouts that use this script
                                                                                        Scripts that use this script
                                                                                          Script Definition
                                                                                          Script Steps
                                                                                          • #Find text and delete it
                                                                                          • #Initialize DynaPDF if needed
                                                                                          • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                          • Perform Script [ “InitDynaPDF” ]
                                                                                          • End If
                                                                                          • #Clear current PDF document
                                                                                          • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                          • #Load PDF from container
                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                                                          • #import a page
                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1) ]
                                                                                          • #initialize parser
                                                                                          • Set Variable [ $OptimizeFlags; Value:0 ]
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.SetAltFont"; $pdf; "Helvetica"; 0; 12) ]
                                                                                          • #We collect positions in a quicklist
                                                                                          • Set Variable [ $list; Value:MBS("QuickList.New") ]
                                                                                          • Set Variable [ $page; Value:1 ]
                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") // parser delivers top down coordinates ]
                                                                                          • #Now parse a page
                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; $page; "EnableTextSelection") ]
                                                                                          • If [ MBS("IsError") ]
                                                                                          • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                          • Else
                                                                                          • #Run a find
                                                                                          • Set Variable [ $continueFind; Value:0 ]
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                                          • If [ $r = 1 ]
                                                                                          • Loop [ Flush: Defer ]
                                                                                          • #store position
                                                                                          • Set Variable [ $rectangle; Value:MBS( "DynaPDF.Parser.SelectionBBox"; $pdf ) ]
                                                                                          • Set Variable [ $r; Value:MBS("QuickList.Push"; $list; $rectangle) ]
                                                                                          • #Continue search
                                                                                          • Set Variable [ $continueFind; Value:1 ]
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
                                                                                          • Exit Loop If [ $r ≠ 1 ]
                                                                                          • End Loop
                                                                                          • #now delete them all
                                                                                          • If [ MBS("QuickList.Count"; $list) > 0 ]
                                                                                          • Loop [ Flush: Defer ]
                                                                                          • Set Variable [ $rectangle; Value:MBS("QuickList.Pop"; $list) ]
                                                                                          • Set Variable [ $x1; Value:GetAsNumber(GetValue($rectangle; 1)) ]
                                                                                          • Set Variable [ $y1; Value:GetAsNumber(GetValue($rectangle; 2)) ]
                                                                                          • Set Variable [ $x2; Value:GetAsNumber(GetValue($rectangle; 3)) ]
                                                                                          • Set Variable [ $y2; Value:GetAsNumber(GetValue($rectangle; 4)) ]
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.DeleteText"; $pdf; $x1; $y1; $x2; $y2) ]
                                                                                          • Exit Loop If [ MBS("QuickList.Count"; $list) < 1 ]
                                                                                          • End Loop
                                                                                          • End If
                                                                                          • #Save changes back
                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
                                                                                          • End If
                                                                                          • End If
                                                                                          • Set Variable [ $r; Value:MBS("QuickList.Free"; $list) ]
                                                                                          • #save
                                                                                          • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                                                          • #Cleanup
                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                          Fields used in this script
                                                                                          Scripts used in this script
                                                                                          Layouts used in this script
                                                                                            Tables used in this script
                                                                                            Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Previous Script: [Find Text and delete text] Next Script: [-]
                                                                                                Script Name Delete Text
                                                                                                Run script with full access privileges Off
                                                                                                Siri Shortcut Visible Off
                                                                                                Include In Menu Yes
                                                                                                Layouts that use this script
                                                                                                  Scripts that use this script
                                                                                                    Script Definition
                                                                                                    Script Steps
                                                                                                    • Set Variable [ $r; Value:MBS("Trace") ]
                                                                                                    • #Initialize DynaPDF if needed
                                                                                                    • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                    • Perform Script [ “InitDynaPDF” ]
                                                                                                    • End If
                                                                                                    • #Clear current PDF document
                                                                                                    • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                    • #Load PDF from container
                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                                                                    • #import a page
                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1) ]
                                                                                                    • #initialize parser
                                                                                                    • Set Variable [ $OptimizeFlags; Value:0 ]
                                                                                                    • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                                                                    • #Now parse a page
                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; 1; "EnableTextSelection") ]
                                                                                                    • If [ MBS("IsError") ]
                                                                                                    • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                    • Else
                                                                                                    • #Define the rectangle
                                                                                                    • Set Variable [ $areaLeft; Value:200 ]
                                                                                                    • Set Variable [ $areaWidth; Value:200 ]
                                                                                                    • Set Variable [ $areaTop; Value:200 ]
                                                                                                    • Set Variable [ $areaHeight; Value:200 ]
                                                                                                    • #we need right and bottom. And since coordinates are bottom-up, we bottom is the smaller y value
                                                                                                    • Set Variable [ $areaRight; Value:$areaLeft + $areaWidth ]
                                                                                                    • Set Variable [ $areaBottom; Value:$areaTop ]
                                                                                                    • Set Variable [ $areaTop; Value:$areaTop + $areaHeight ]
                                                                                                    • #now delete text in that area
                                                                                                    • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.DeleteText"; $pdf; $areaTop; $areaBottom; $areaLeft; $areaRight) ]
                                                                                                    • If [ MBS("IsError") ]
                                                                                                    • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                    • Else
                                                                                                    • #Save changes back
                                                                                                    • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
                                                                                                    • End If
                                                                                                    • End If
                                                                                                    • #save
                                                                                                    • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                                                                    • #Cleanup
                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                    Fields used in this script
                                                                                                    Scripts used in this script
                                                                                                    Layouts used in this script
                                                                                                      Tables used in this script
                                                                                                      Table occurrences used by this script
                                                                                                      Custom Functions used by this script
                                                                                                        Custom menu set used by this script

                                                                                                          Previous Script: [Delete Text] Next Script: [Import PDF]
                                                                                                          Script Name -
                                                                                                          Run script with full access privileges Off
                                                                                                          Siri Shortcut Visible Off
                                                                                                          Include In Menu Yes
                                                                                                          Layouts that use this script
                                                                                                            Scripts that use this script
                                                                                                              Script Definition
                                                                                                              Script Steps
                                                                                                                Fields used in this script
                                                                                                                  Scripts used in this script
                                                                                                                    Layouts used in this script
                                                                                                                      Tables used in this script
                                                                                                                        Table occurrences used by this script
                                                                                                                          Custom Functions used by this script
                                                                                                                            Custom menu set used by this script

                                                                                                                              Previous Script: [-] Next Script: [Export PDF]
                                                                                                                              Script Name Import PDF
                                                                                                                              Run script with full access privileges Off
                                                                                                                              Siri Shortcut Visible Off
                                                                                                                              Include In Menu Yes
                                                                                                                              Layouts that use this script
                                                                                                                              Scripts that use this script
                                                                                                                                Script Definition
                                                                                                                                Script Steps
                                                                                                                                • Go to Field [ DynaPDF Replace Text::InputPDF ]
                                                                                                                                • Insert File [ ] [ Filters ] [ "PDF Files": ( *.pdf ) ] [ Storage method: Let user choose ] [ Display content ] [ Compression: Never compress ]
                                                                                                                                Fields used in this script
                                                                                                                                Scripts used in this script
                                                                                                                                  Layouts used in this script
                                                                                                                                    Tables used in this script
                                                                                                                                    Table occurrences used by this script
                                                                                                                                    Custom Functions used by this script
                                                                                                                                      Custom menu set used by this script

                                                                                                                                        Previous Script: [Import PDF] Next Script: [Clear]
                                                                                                                                        Script Name Export PDF
                                                                                                                                        Run script with full access privileges Off
                                                                                                                                        Siri Shortcut Visible Off
                                                                                                                                        Include In Menu Yes
                                                                                                                                        Layouts that use this script
                                                                                                                                        Scripts that use this script
                                                                                                                                          Script Definition
                                                                                                                                          Script Steps
                                                                                                                                          • Export Field Contents [ DynaPDF Replace Text::OutputPDF; Create folders:Yes ]
                                                                                                                                          Fields used in this script
                                                                                                                                          Scripts used in this script
                                                                                                                                            Layouts used in this script
                                                                                                                                              Tables used in this script
                                                                                                                                              Table occurrences used by this script
                                                                                                                                              Custom Functions used by this script
                                                                                                                                                Custom menu set used by this script

                                                                                                                                                  Previous Script: [Export PDF] Next Script: [-]
                                                                                                                                                  Script Name Clear
                                                                                                                                                  Run script with full access privileges Off
                                                                                                                                                  Siri Shortcut Visible Off
                                                                                                                                                  Include In Menu Yes
                                                                                                                                                  Layouts that use this script
                                                                                                                                                    Scripts that use this script
                                                                                                                                                      Script Definition
                                                                                                                                                      Script Steps
                                                                                                                                                      • Replace Field Contents [ DynaPDF Replace Text::InputPDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                                                      • Replace Field Contents [ DynaPDF Replace Text::OutputPDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                                                      Fields used in this script
                                                                                                                                                      Scripts used in this script
                                                                                                                                                        Layouts used in this script
                                                                                                                                                          Tables used in this script
                                                                                                                                                          Table occurrences used by this script
                                                                                                                                                          Custom Functions used by this script
                                                                                                                                                            Custom menu set used by this script

                                                                                                                                                              Previous Script: [Clear] Next Script: [Delete All Images]
                                                                                                                                                              Script Name -
                                                                                                                                                              Run script with full access privileges Off
                                                                                                                                                              Siri Shortcut Visible Off
                                                                                                                                                              Include In Menu Yes
                                                                                                                                                              Layouts that use this script
                                                                                                                                                                Scripts that use this script
                                                                                                                                                                  Script Definition
                                                                                                                                                                  Script Steps
                                                                                                                                                                    Fields used in this script
                                                                                                                                                                      Scripts used in this script
                                                                                                                                                                        Layouts used in this script
                                                                                                                                                                          Tables used in this script
                                                                                                                                                                            Table occurrences used by this script
                                                                                                                                                                              Custom Functions used by this script
                                                                                                                                                                                Custom menu set used by this script

                                                                                                                                                                                  Previous Script: [-]
                                                                                                                                                                                  Script Name Delete All Images
                                                                                                                                                                                  Run script with full access privileges Off
                                                                                                                                                                                  Siri Shortcut Visible Off
                                                                                                                                                                                  Include In Menu Yes
                                                                                                                                                                                  Layouts that use this script
                                                                                                                                                                                    Scripts that use this script
                                                                                                                                                                                      Script Definition
                                                                                                                                                                                      Script Steps
                                                                                                                                                                                      • #Find Text in the page and replace with new text
                                                                                                                                                                                      • #Initialize DynaPDF if needed
                                                                                                                                                                                      • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                                                      • Perform Script [ “InitDynaPDF” ]
                                                                                                                                                                                      • End If
                                                                                                                                                                                      • #Clear current PDF document
                                                                                                                                                                                      • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                                                                                                      • #Load PDF from container
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF Replace Text::InputPDF) ]
                                                                                                                                                                                      • #import a page
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1) ]
                                                                                                                                                                                      • #initialize parser
                                                                                                                                                                                      • Set Variable [ $OptimizeFlags; Value:0 ]
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
                                                                                                                                                                                      • #Now parse a page
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.Parser.ParsePage"; $pdf; 1; "EnableTextSelection") ]
                                                                                                                                                                                      • If [ MBS("IsError") ]
                                                                                                                                                                                      • Show Custom Dialog [ Title: "Failed to parse page"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                      • Else
                                                                                                                                                                                      • #Delete images
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.DeleteAllImages"; $pdf) ]
                                                                                                                                                                                      • #Save changes back
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
                                                                                                                                                                                      • End If
                                                                                                                                                                                      • #save
                                                                                                                                                                                      • Set Field [ DynaPDF Replace Text::OutputPDF; MBS( "DynaPDF.Save"; $pdf; "output.pdf" ) ]
                                                                                                                                                                                      • #Cleanup
                                                                                                                                                                                      • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                                                                                                      Fields used in this script
                                                                                                                                                                                      Scripts used in this script
                                                                                                                                                                                      Layouts used in this script
                                                                                                                                                                                        Tables used in this script
                                                                                                                                                                                        Table occurrences used by this script
                                                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                                                            Download example: Find and Replace Text

                                                                                                                                                                                            Used functions: