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
Tables1
Relationships0
Layouts1
Scripts2
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
Page Layouting
10 fields defined, 1 record
Page Layouting

Fields

Table Name: Page Layouting - 10 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
                                          TextNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                              Picture LeftNormal, BinaryAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                                  Picture RightNormal, BinaryAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                      HeaderNormal, TextAuto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          PDFNormal, BinaryAuto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1

                                                              Layout Objects: Page Layouting

                                                              Regular Fields

                                                              Field Name: Page Layouting::Text
                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesScript/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

                                                              Next Script: [Make PDF]
                                                              Script NameInitDynaPDF
                                                              Run script with full access privilegesOff
                                                              Siri Shortcut VisibleOff
                                                              Include In MenuNo
                                                              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]
                                                                              Script NameMake PDF
                                                                              Run script with full access privilegesOff
                                                                              Siri Shortcut VisibleOff
                                                                              Include In MenuYes
                                                                              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: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 ]
                                                                                • #first 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 ]
                                                                                • #second 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 ]
                                                                                • #third 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 ]
                                                                                • #forth 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 page
                                                                                • 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

                                                                                      Download example: Page Layouting

                                                                                      Used functions: