MBS FileMaker Plugin Example Databases

Personalized PDFs

All examples are included with download of MBS FileMaker Plugin.

Personalized PDFs.fmp12

Overview
Tables1
Relationships0
Layouts4
Scripts6
Value Lists0
Custom Functions0
Custom Menus0
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
OnFirstWindowOpenScript: Trigger On File Open
OnLastWindowCloseScript: Trigger On File Close
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Personalized PDFs
4 fields defined, 3 records
Personalized PDFs

Fields

Table Name: Personalized PDFs - 4 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
FilenameNormal, TextAuto-Enter: Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
        FileNormal, BinaryAuto-Enter:
        • Allow editing
        Validation:
        • Only during data entry
        Storage:
        • Repetitions: 1
            PersonalizedFileNormal, BinaryAuto-Enter:
            • Allow editing
            Validation:
            • Only during data entry
            Storage:
            • Global
            • Repetitions: 1
                ClientNameNormal, TextAuto-Enter:
                • Allow editing
                Validation:
                • Only during data entry
                Storage:
                • Global
                • Repetitions: 1
                • Index Language: German

                    Layout Objects: Admin

                    Regular Fields

                    Field Name: Personalized PDFs::Filename
                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                    • Top: 52 pt
                    • Left: 138 pt
                    • Bottom: 73 pt
                    • Right: 391 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: Personalized PDFs::File
                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                    • Top: 75 pt
                    • Left: 138 pt
                    • Bottom: 523 pt
                    • Right: 705 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: Go to Client View
                    • Top: 10 pt
                    • Left: 14 pt
                    • Bottom: 40 pt
                    • Right: 156 pt
                    • Anchoring: Left, Top
                    Go to Layout [ “Client” ]

                    Layouts:


                    Layout Objects: Client

                    Regular Fields

                    Field Name: Personalized PDFs::Filename
                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                    • Top: 52 pt
                    • Left: 138 pt
                    • Bottom: 73 pt
                    • Right: 391 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: Personalized PDFs::PersonalizedFile
                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                    • Top: 74 pt
                    • Left: 138 pt
                    • Bottom: 523 pt
                    • Right: 705 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: Personalized PDFs::ClientName
                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                    • Top: 10 pt
                    • Left: 756 pt
                    • Bottom: 31 pt
                    • Right: 1009 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: Go to Admin View
                    • Top: 10 pt
                    • Left: 14 pt
                    • Bottom: 40 pt
                    • Right: 157 pt
                    • Anchoring: Left, Top
                    Go to Layout [ “Admin” ]

                    Layouts:


                    Script Hierarchy

                    InitDynaPDF
                    Personalize PDF
                    -
                    Trigger On File Close
                    Trigger On File Open
                    Trigger On Record Load

                    Next Script: [Personalize PDF]
                    Script NameInitDynaPDF
                    Run script with full access privilegesOff
                    Include In MenuNo
                    Layouts that use this script
                      Scripts that use this script
                      Script Definition
                      Script Steps
                      • #Locate DynaPDF library
                      • 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" ) ]
                      • Else
                      • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                      • End If
                      • #Initialize DynaPDF
                      • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path) ]
                      • If [ $r ≠ "OK" ]
                      • Show Custom Dialog [ Title: "DynaPDF failed to initialize"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                      • Else
                      • Set Variable [ $$DynaPDFInited; Value:1 ]
                      • 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: [-]
                                    Script NamePersonalize PDF
                                    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
                                      • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                      • Exit Script [ ]
                                      • End If
                                      • #Start new PDF
                                      • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                      • #Set some flags for import
                                      • Set Variable [ $r; Value:MBS("DynaPDF.SetImportFlags"; $pdf; "ImportAll ImportAsPage") ]
                                      • #Add first page
                                      • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Personalized PDFs::File) ]
                                      • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
                                      • #set coordinates to go from top to down
                                      • Set Variable [ $r; Value:MBS( "DynaPDF.SetPageCoords"; $PDF; "TopDown" ) ]
                                      • #Edit pages
                                      • Set Variable [ $PageCount; Value:MBS( "DynaPDF.GetPageCount"; $pdf ) ]
                                      • Set Variable [ $PageNumber; Value:1 ]
                                      • Set Variable [ $pageWidth; Value:MBS("DynaPDF.GetPageWidth"; $pdf) ]
                                      • Set Variable [ $pageHeight; Value:MBS("DynaPDF.GetPageHeight"; $pdf) ]
                                      • Loop
                                      • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $PageNumber) ]
                                      • #add page number
                                      • Set Variable [ $r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; 0; 20) ]
                                      • Set Variable [ $r; Value:MBS( "DynaPDF.WriteFTextEx"; $pdf; 50; $pageHeight - 50; $pageWidth-100; 30; "right"; GetAsText($PageNumber) & " of " & $PageCount) ]
                                      • Set Variable [ $r; Value:MBS( "DynaPDF.WriteFTextEx"; $pdf; 50; $pageHeight - 50; $pageWidth-100; 30; "left"; Personalized PDFs::ClientName) ]
                                      • #next page
                                      • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                      • Set Variable [ $PageNumber; Value:$PageNumber +1 ]
                                      • Exit Loop If [ $PageNumber > $PageCount ]
                                      • End Loop
                                      • #save PDF
                                      • Set Variable [ $PDFData; Value:MBS("DynaPDF.Save"; $pdf; GetAsText(Personalized PDFs::File)) ]
                                      • #Free all data
                                      • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                      • #Put in Container
                                      • Set Field [ Personalized PDFs::PersonalizedFile; $PDFData ]
                                      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: [Personalize PDF]Next Script: [Trigger On File Close]
                                            Script Name-
                                            Run script with full access privilegesOff
                                            Include In MenuYes
                                            Layouts that use this script
                                              Scripts that use this script
                                                Script Definition
                                                Script Steps
                                                  Fields used in this script
                                                    Scripts used in this script
                                                      Layouts used in this script
                                                        Tables used in this script
                                                          Table occurrences used by this script
                                                            Custom Functions used by this script
                                                              Custom menu set used by this script

                                                                Previous Script: [-]Next Script: [Trigger On File Open]
                                                                Script NameTrigger On File Close
                                                                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 [ Personalized PDFs::PersonalizedFile; "" ]
                                                                    • Set Field [ Personalized PDFs::ClientName; "" ]
                                                                    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: [Trigger On File Close]Next Script: [Trigger On Record Load]
                                                                            Script NameTrigger On File Open
                                                                            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 [ Personalized PDFs::ClientName; MBS("SystemInfo.Username") ]
                                                                                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: [Trigger On File Open]
                                                                                        Script NameTrigger On Record Load
                                                                                        Run script with full access privilegesOff
                                                                                        Include In MenuYes
                                                                                        Layouts that use this script
                                                                                          Scripts that use this script
                                                                                            Script Definition
                                                                                            Script Steps
                                                                                            • Perform Script [ “Personalize PDF” ]
                                                                                            Fields used in this script
                                                                                              Scripts used in this script
                                                                                              Layouts used in this script
                                                                                                Tables used in this script
                                                                                                  Table occurrences used by this script
                                                                                                    Custom Functions used by this script
                                                                                                      Custom menu set used by this script

                                                                                                        Download example: Personalized PDFs

                                                                                                        Used functions:




                                                                                                        Links
                                                                                                        MBS Xojo Plugins