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

MBS FileMaker Plugin Example Databases

Add Page Links

All examples are included with download of MBS FileMaker Plugin.

Add Page Links.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts3
Value Lists0
Custom Functions0
Custom Menus24
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Add Page Links
14 fields defined, 1 record
Add Page Links

Fields

Table Name: Add Page Links - 14 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PrimaryKeyNormal, TextAuto-Enter: Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Unique identifier of each record in this table
          CreationTimestampNormal, TimestampAuto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Date and time each record was created
                  CreatedByNormal, TextAuto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Account name of the user who created each record
                          ModificationTimestampNormal, TimestampAuto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Date and time each record was last modified
                                  ModifiedByNormal, TextAuto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Account name of the user who last modified each record
                                          Input PDFNormal, BinaryAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                              Output PDFNormal, BinaryAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                                  First Index PageNormal, NumberAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: German
                                                      Last Index PageNormal, NumberAuto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          Height of RowNormal, NumberAuto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                          • Indexing: None
                                                          • Automatically create indexes as needed
                                                          • Index Language: German
                                                              Distance LeftNormal, NumberAuto-Enter:
                                                              • Allow editing
                                                              Validation:
                                                              • Only during data entry
                                                              Storage:
                                                              • Repetitions: 1
                                                              • Indexing: None
                                                              • Automatically create indexes as needed
                                                              • Index Language: German
                                                                  Distance TopNormal, NumberAuto-Enter:
                                                                  • Allow editing
                                                                  Validation:
                                                                  • Only during data entry
                                                                  Storage:
                                                                  • Repetitions: 1
                                                                  • Indexing: None
                                                                  • Automatically create indexes as needed
                                                                  • Index Language: German
                                                                      WidthNormal, NumberAuto-Enter:
                                                                      • Allow editing
                                                                      Validation:
                                                                      • Only during data entry
                                                                      Storage:
                                                                      • Repetitions: 1
                                                                      • Indexing: None
                                                                      • Automatically create indexes as needed
                                                                      • Index Language: German
                                                                          Numbers foundNormal, NumberAuto-Enter:
                                                                          • Allow editing
                                                                          Validation:
                                                                          • Only during data entry
                                                                          Storage:
                                                                          • Repetitions: 1
                                                                          • Indexing: None
                                                                          • Automatically create indexes as needed
                                                                          • Index Language: German

                                                                              Layout Objects: Add Page Links

                                                                              Regular Fields

                                                                              Field Name: Add Page Links::Input PDF
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 62 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 187 pt
                                                                              • Right: 622 pt
                                                                              • Anchoring: Left and Right, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              No

                                                                              Field Name: Add Page Links::Output PDF
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 448 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 824 pt
                                                                              • Right: 622 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: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              No

                                                                              Field Name: Add Page Links::First Index Page
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 197 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 228 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Last Index Page
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 232 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 263 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Height of Row
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 372 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 403 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Distance Left
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 267 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 298 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Distance Top
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 302 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 333 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Width
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 337 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 368 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Field Name: Add Page Links::Numbers found
                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                              • Top: 407 pt
                                                                              • Left: 138 pt
                                                                              • Bottom: 438 pt
                                                                              • Right: 217 pt
                                                                              • Anchoring: Left, Top
                                                                              Field Format:
                                                                              • Edit Box
                                                                              Field Behavior:
                                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                                              • Touch keyboard type: Default for Data Type
                                                                              • Go to next field using: Tab key
                                                                              Yes

                                                                              Buttons

                                                                              Button PropertiesCoordinatesScript/Script Step
                                                                                Type:
                                                                              • Text: Do it!
                                                                              • Top: 398 pt
                                                                              • Left: 443 pt
                                                                              • Bottom: 438 pt
                                                                              • Right: 593 pt
                                                                              • Anchoring: Left, Top
                                                                              Perform Script [ “Merge” ]

                                                                              Scripts:


                                                                              Script Hierarchy

                                                                              InitDynaPDF
                                                                              Merge
                                                                              Clear

                                                                              Next Script: [Merge]
                                                                              Script NameInitDynaPDF
                                                                              Run script with full access privilegesOff
                                                                              Include In MenuYes
                                                                              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:"" // 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: [Clear]
                                                                                              Script NameMerge
                                                                                              Run script with full access privilegesOff
                                                                                              Include In MenuYes
                                                                                              Layouts that use this script
                                                                                              Scripts that use this script
                                                                                                Script Definition
                                                                                                Script Steps
                                                                                                • #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") ]
                                                                                                • #optionally we can merge to external file
                                                                                                • If [ False ]
                                                                                                • Set Variable [ $destPath; Value:MBS("Folders.UserDesktop") & "/test.pdf" ]
                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenOutputFile"; $pdf; $destPath) ]
                                                                                                • If [ MBS("IsError") ]
                                                                                                • Show Custom Dialog [ Title: "Failed to create PDF file."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                • Exit Script [ ]
                                                                                                • End If
                                                                                                • End If
                                                                                                • #Merge files
                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Add Page Links::Input PDF) ]
                                                                                                • If [ MBS("IsError") ]
                                                                                                • Show Custom Dialog [ Title: "Failed to open PDF."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                • Exit Script [ ]
                                                                                                • End If
                                                                                                • #check if we have pages to import
                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf) ]
                                                                                                • If [ MBS("IsError") ]
                                                                                                • Show Custom Dialog [ Title: "Failed to import PDF."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                • Exit Script [ ]
                                                                                                • End If
                                                                                                • #now add page numbers
                                                                                                • Set Variable [ $Found; Value:0 ]
                                                                                                • Set Variable [ $page; Value:Add Page Links::First Index Page ]
                                                                                                • Loop
                                                                                                • #edit page
                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $page) ]
                                                                                                • If [ MBS("IsError") = 0 ]
                                                                                                • Set Variable [ $pageHeight; Value:MBS( "DynaPDF.GetPageHeight"; $PDF ) ]
                                                                                                • Set Variable [ $pageWidth; Value:MBS( "DynaPDF.GetPageWidth"; $PDF ) ]
                                                                                                • Set Variable [ $x; Value:Add Page Links::Distance Left ]
                                                                                                • Set Variable [ $y; Value:Add Page Links::Distance Top ]
                                                                                                • Set Variable [ $rowHeight; Value:Add Page Links::Height of Row ]
                                                                                                • Loop
                                                                                                • #look for number
                                                                                                • Set Variable [ $text; Value:MBS( "DynaPDF.ExtractText"; $pdf; $page; ""; $x; $y; $x + Add Page Links::Width; $y + $rowHeight-5) ]
                                                                                                • If [ Length ( Trim ($text) ) > 0 ]
                                                                                                • #we found some text
                                                                                                • If [ 0 ]
                                                                                                • #Optionally, show text we found
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; ""; 20) ]
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.WriteText"; $pdf; $x-100; $y; $text ) ]
                                                                                                • End If
                                                                                                • If [ 0 ]
                                                                                                • #Optionally, draw some red boxes where we read text
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetFillColor"; $pdf; Random; 0; 0) ]
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetStrokeColor"; $pdf; Random; 0; 0) ]
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.Rectangle"; $pdf; $x; $y; Add Page Links::Width; $rowHeight; "stroke" ) ]
                                                                                                • End If
                                                                                                • #add page link for the area we found
                                                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.PageLink"; $pdf; 0; $y; $pageWidth; $rowHeight; $text ) ]
                                                                                                • Set Variable [ $Found; Value:$Found + 1 ]
                                                                                                • End If
                                                                                                • #next
                                                                                                • Set Variable [ $y; Value:$y + $rowHeight ]
                                                                                                • Exit Loop If [ $y > $pageHeight ]
                                                                                                • End Loop
                                                                                                • End If
                                                                                                • #next
                                                                                                • Set Variable [ $page; Value:$page + 1 ]
                                                                                                • Exit Loop If [ $page > Add Page Links::Last Index Page ]
                                                                                                • End Loop
                                                                                                • Set Field [ Add Page Links::Numbers found; $Found ]
                                                                                                • #to debug, you can disable compression and open PDF in text editor
                                                                                                • // Set Variable [ $r; Value:MBS("DynaPDF.SetCompressionLevel"; $pdf; 0) ]
                                                                                                • #show final PDF
                                                                                                • Set Field [ Add Page Links::Output PDF; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ]
                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                • Export Field Contents [ Add Page Links::Output PDF; “file:test.pdf”; Automatically open; Create directories:No ]
                                                                                                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: [Merge]
                                                                                                      Script NameClear
                                                                                                      Run script with full access privilegesOff
                                                                                                      Include In MenuYes
                                                                                                      Layouts that use this script
                                                                                                        Scripts that use this script
                                                                                                          Script Definition
                                                                                                          Script Steps
                                                                                                          • Set Field [ Add Page Links::Output PDF; "" ]
                                                                                                          • Set Field [ Add Page Links::Numbers found; "" ]
                                                                                                          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: Add Page Links

                                                                                                                  Used functions: