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

MBS FileMaker Plugin Example Databases

Page Layouting

All examples are included with download of MBS FileMaker Plugin.

Page Layouting.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 3
Value Lists 0
Custom Functions 0
Custom Menus 24
File Options
Default custom menu set [Standard FileMaker Menus]
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 On
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
Page Layouting
10 fields defined, 1 record
Page Layouting

Fields

Table Name: Page Layouting - 10 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
PrimaryKey Normal, Text Auto-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
          CreationTimestamp Normal, Timestamp Auto-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
                  CreatedBy Normal, Text Auto-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
                          ModificationTimestamp Normal, Timestamp Auto-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
                                  ModifiedBy Normal, Text Auto-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
                                          Text Normal, Text Auto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                              Picture Left Normal, Binary Auto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                                  Picture Right Normal, Binary Auto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                      Header Normal, Text Auto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          PDF Normal, Binary Auto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1

                                                              Layout Objects: Page Layouting

                                                              Regular Fields

                                                              Field Name: Page Layouting::Text
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 222 pt
                                                              • Left: 138 pt
                                                              • Bottom: 532 pt
                                                              • Right: 492 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: Page Layouting::Header
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 116 pt
                                                              • Left: 138 pt
                                                              • Bottom: 212 pt
                                                              • Right: 1006 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: Page Layouting::Picture Left
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 542 pt
                                                              • Left: 138 pt
                                                              • Bottom: 696 pt
                                                              • Right: 492 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
                                                              No

                                                              Field Name: Page Layouting::Picture Right
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 698 pt
                                                              • Left: 138 pt
                                                              • Bottom: 852 pt
                                                              • Right: 492 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
                                                              No

                                                              Field Name: Page Layouting::PDF
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 222 pt
                                                              • Left: 550 pt
                                                              • Bottom: 852 pt
                                                              • Right: 1006 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
                                                              No

                                                              Buttons

                                                              Button Properties Coordinates Script/Script Step
                                                                Type:
                                                              • Text: Create PDF
                                                              • Top: 34 pt
                                                              • Left: 810 pt
                                                              • Bottom: 76 pt
                                                              • Right: 979 pt
                                                              • Anchoring: Left, Top
                                                              Perform Script [ “Make PDF” ]

                                                              Scripts:


                                                              Script Hierarchy

                                                              InitDynaPDF
                                                              Make PDF
                                                              Clear

                                                              Next Script: [Make PDF]
                                                              Script Name InitDynaPDF
                                                              Run script with full access privileges Off
                                                              Siri Shortcut Visible Off
                                                              Include In Menu No
                                                              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 Name Make 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
                                                                                • 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") ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                • Set Variable [ $OneInch; Value:72 ]
                                                                                • Set Variable [ $PosX; Value:$OneInch ]
                                                                                • Set Variable [ $PageHeight; Value:MBS("DynaPDF.GetPageHeight"; $pdf) ]
                                                                                • Set Variable [ $PageWidth; Value:MBS("DynaPDF.GetPageWidth"; $pdf) ]
                                                                                • Set Variable [ $TextWidth; Value:$pageWidth - 2 * $OneInch ]
                                                                                • Set Variable [ $TextHeight; Value:$pageHeight - 2 * $OneInch ]
                                                                                • Set Variable [ $ColumnWidth; Value:$textWidth / 2 - 10 ]
                                                                                • #Write header
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $pageHeight - $OneInch; $TextWidth; -1) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.WriteStyledText"; $pdf; "center"; Page Layouting::Header) ]
                                                                                • Set Variable [ $TextY; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                • #Left picture with round borders
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SaveGraphicState"; $pdf) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ReadImageFormat"; $pdf; Page Layouting::Picture Left) ]
                                                                                • Set Variable [ $ImageWidth; Value:GetAsNumber (LeftValues ( $r ; 1 )) ]
                                                                                • Set Variable [ $ImageHeight; Value:GetAsNumber (MiddleValues ( $r ; 2; 1 )) ]
                                                                                • Set Variable [ $LeftPicWidth; Value:$ColumnWidth ]
                                                                                • Set Variable [ $LeftPicHeight; Value:$ColumnWidth / $ImageWidth * $ImageHeight ]
                                                                                • Set Variable [ $LeftPicTop; Value:If($LeftPicHeight > 250; 250; 400) ]
                                                                                • Set Variable [ $LeftPicLeft; Value:$OneInch ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.RoundRectEx"; $pdf; $LeftPicLeft; $LeftPicTop; $LeftPicWidth; $LeftPicHeight; 10; 10; "NoFill") ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ClipPath"; $pdf; "Winding"; "fill" ) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.InsertImage"; $pdf; Page Layouting::Picture Left; $LeftPicLeft; $LeftPicTop; $LeftPicWidth; $LeftPicHeight; 1) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.RestoreGraphicState"; $pdf) ]
                                                                                • #Right picture with round borders
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SaveGraphicState"; $pdf) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ReadImageFormat"; $pdf; Page Layouting::Picture Right) ]
                                                                                • Set Variable [ $ImageWidth; Value:GetAsNumber (LeftValues ( $r ; 1 )) ]
                                                                                • Set Variable [ $ImageHeight; Value:GetAsNumber (MiddleValues ( $r ; 2; 1 )) ]
                                                                                • Set Variable [ $RightPicWidth; Value:$ColumnWidth ]
                                                                                • Set Variable [ $RightPicHeight; Value:$ColumnWidth / $ImageWidth * $ImageHeight ]
                                                                                • Set Variable [ $RightPicTop; Value:200 ]
                                                                                • Set Variable [ $RightPicLeft; Value:$OneInch + $TextWidth - $ColumnWidth ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.RoundRectEx"; $pdf; $RightPicLeft; $RightPicTop; $RightPicWidth; $RightPicHeight; 10; 10; "NoFill") ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ClipPath"; $pdf; "Winding"; "fill" ) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.InsertImage"; $pdf; Page Layouting::Picture Right; $RightPicLeft; $RightPicTop; $RightPicWidth; $RightPicHeight; 1) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.RestoreGraphicState"; $pdf) ]
                                                                                • #draw big L
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; "Georgia"; 2; 20) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $TextY; 50; 50 ) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.WriteStyledText"; $pdf; "left"; TextSize ( Left(Page Layouting::Text; 1); 30)) ]
                                                                                • Set Variable [ $LastX; Value:MBS("DynaPDF.GetLastTextPosX"; $pdf) + 3 ]
                                                                                • Set Variable [ $LastY; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 3 ]
                                                                                • #first box for text
                                                                                • Set Variable [ $SectionLeft; Value:$lastX ]
                                                                                • Set Variable [ $SectionTop; Value:$TextY ]
                                                                                • Set Variable [ $SectionWidth; Value:$ColumnWidth - $lastX + $PosX ]
                                                                                • Set Variable [ $SectionHeight; Value:$SectionTop[1] - $LastY + 10 ]
                                                                                • #second box for text
                                                                                • Set Variable [ $SectionLeft[2]; Value:$PosX ]
                                                                                • Set Variable [ $SectionTop[2]; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 6 ]
                                                                                • Set Variable [ $SectionWidth[2]; Value:$ColumnWidth ]
                                                                                • Set Variable [ $SectionHeight[2]; Value:$SectionTop[2] - $LeftPicTop - 10 - $LeftPicHeight ]
                                                                                • #third box for text
                                                                                • Set Variable [ $SectionLeft[3]; Value:$PosX ]
                                                                                • Set Variable [ $SectionTop[3]; Value:$LeftPicTop - 10 ]
                                                                                • Set Variable [ $SectionWidth[3]; Value:$ColumnWidth ]
                                                                                • Set Variable [ $SectionHeight[3]; Value:$SectionTop[3] - $OneInch ]
                                                                                • #forth box for text
                                                                                • Set Variable [ $SectionLeft[4]; Value:$RightPicLeft ]
                                                                                • Set Variable [ $SectionTop[4]; Value:$TextY ]
                                                                                • Set Variable [ $SectionWidth[4]; Value:$ColumnWidth ]
                                                                                • Set Variable [ $SectionHeight[4]; Value:$TextY - $RightPicTop - 10 - $RightPicHeight ]
                                                                                • #five box for text
                                                                                • Set Variable [ $SectionLeft[5]; Value:$RightPicLeft ]
                                                                                • Set Variable [ $SectionTop[5]; Value:$RightPicTop - 10 ]
                                                                                • Set Variable [ $SectionWidth[5]; Value:$ColumnWidth ]
                                                                                • Set Variable [ $SectionHeight[5]; Value:$SectionTop[5] - $OneInch ]
                                                                                • #next and future pages
                                                                                • Set Variable [ $SectionLeft[6]; Value:$OneInch ]
                                                                                • Set Variable [ $SectionTop[6]; Value:$pageHeight - $OneInch ]
                                                                                • Set Variable [ $SectionWidth[6]; Value:$TextWidth ]
                                                                                • Set Variable [ $SectionHeight[6]; Value:$TextHeight ]
                                                                                • If [ 0 ]
                                                                                • #show rectangles with lines
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 1; 0; 0) ]
                                                                                • Set Variable [ $index; Value:1 ]
                                                                                • Loop [ Flush: Always ]
                                                                                • #with - for height, since WriteFText draws the box from Top position down
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Rectangle"; $pdf; $SectionLeft[$index]; $SectionTop[$index]; $SectionWidth[$index]; -$SectionHeight[$index]; "stroke") ]
                                                                                • #next
                                                                                • Set Variable [ $index; Value:$index + 1 ]
                                                                                • Exit Loop If [ $index > 6 ]
                                                                                • End Loop
                                                                                • End If
                                                                                • Set Variable [ $section; Value:1 ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $SectionLeft[$section]; $SectionTop[$section]; $SectionWidth[$section]; $SectionHeight[$section] ) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AllowPageBreak"; $pdf; 1) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetPageBreakExpression"; $pdf; "Let ( [ $section = Min($section + 1; 6); r = If( $section = 6; MBS(\"DynaPDF.EndPage\"; $pdf) & MBS(\"DynaPDF.Append\"; $pdf); 0); a = MBS( \"DynaPDF.SetTextRect\"; $pdf; $SectionLeft[$section]; $SectionTop[$section]; $SectionWidth[$section]; $SectionHeight[$section] ) ]; 0 )") ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.WriteStyledText"; $pdf; "left"; Middle(Page Layouting::Text; 2; Length(Page Layouting::Text))) ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                • #Save PDF
                                                                                • Set Variable [ $PDFData; Value:MBS("DynaPDF.Save"; $pdf; "test.pdf") ]
                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                • #Put in Container
                                                                                • Set Field [ Page Layouting::PDF; $PDFData ]
                                                                                • Export Field Contents [ Page Layouting::PDF; “file:test.pdf”; Automatically open; Create folders: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: [Make PDF]
                                                                                      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 [ Page Layouting::PDF; 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

                                                                                                  Download example: Page Layouting

                                                                                                  Used functions: