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

MBS FileMaker Plugin Example Databases

SVG

All examples are included with download of MBS FileMaker Plugin.

SVG.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]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields 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
Comments
Occurrences in Relationship Graph
SVG
10 fields defined, 0 record
SVG

Fields

Table Name: SVG - 10 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
PrimaryKey Normal, Text Auto-Enter:
  • Context table: SVG
    Calculation: Get( UUID )
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
                                          SVG Normal, Binary Auto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Global
                                          • Repetitions: 1
                                              Image Normal, Binary Auto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                                  Identifier Normal, Text Auto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: German
                                                      Width Normal, Number Auto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          Height Normal, Number Auto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                          • Indexing: None
                                                          • Automatically create indexes as needed
                                                          • Index Language: German

                                                              Layout Objects: SVG

                                                              Regular Fields

                                                              Field Name: SVG::SVG
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 4 pt
                                                              • Left: 138 pt
                                                              • Bottom: 129 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
                                                              No

                                                              Field Name: SVG::Image
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 223 pt
                                                              • Left: 138 pt
                                                              • Bottom: 438 pt
                                                              • Right: 611 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: SVG::Identifier
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 143 pt
                                                              • Left: 138 pt
                                                              • Bottom: 174 pt
                                                              • Right: 414 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: SVG::Width
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 183 pt
                                                              • Left: 138 pt
                                                              • Bottom: 214 pt
                                                              • Right: 239 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: SVG::Height
                                                              Field Properties Coordinates Field Format Field Behavior Quick Find
                                                              • Top: 183 pt
                                                              • Left: 313 pt
                                                              • Bottom: 214 pt
                                                              • Right: 414 pt
                                                              • Anchoring: Left, Top
                                                              Field Format:
                                                              • Edit Box
                                                              Field Behavior:
                                                              • Allow field to be entered: In Find mode, In Browse mode
                                                              • Touch keyboard type: Default for Data Type
                                                              • Go to next field using: Tab key
                                                              Yes

                                                              Buttons

                                                              Button Properties Coordinates Script/Script Step
                                                                Type:
                                                              • Text: Import SVG
                                                                Additional Properties:
                                                              • Change to hand cursor over button
                                                              • Top: 4 pt
                                                              • Left: 438 pt
                                                              • Bottom: 35 pt
                                                              • Right: 588 pt
                                                              • Anchoring: Left, Top
                                                              Insert File [ SVG::SVG ] [ Filters ] [ "SVG files": ( *.svg ) ] [ Storage method: Insert ] [ Display icon ] [ Compression: Never compress ]

                                                              Fields:


                                                              Button Properties Coordinates Script/Script Step
                                                                Type:
                                                              • Text: Render SVG
                                                                Additional Properties:
                                                              • Change to hand cursor over button
                                                              • Top: 98 pt
                                                              • Left: 438 pt
                                                              • Bottom: 129 pt
                                                              • Right: 588 pt
                                                              • Anchoring: Left, Top
                                                              Perform Script [ “Render SVG” ]

                                                              Scripts:


                                                              Script Hierarchy

                                                              Render SVG
                                                              InitDynaPDF
                                                              Clear

                                                              Next Script: [InitDynaPDF]
                                                              Script Name Render SVG
                                                              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 Error Capture [ On ]
                                                                • #Initialize DynaPDF if needed
                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                • Perform Script [ “InitDynaPDF” ]
                                                                • End If
                                                                • If [ IsEmpty ( SVG::SVG ) ]
                                                                • If [ Get(FoundCount) = 0 ]
                                                                • New Record/Request
                                                                • End If
                                                                • Insert File [ SVG::SVG ] [ Filters ] [ "SVG Files": ( *.svg ) ] [ Storage method: Insert ] [ Display icon ] [ Compression: Never compress ]
                                                                • #exit if user cancelled
                                                                • If [ Get(LastError) ≠ 0 ]
                                                                • Exit Script [ ]
                                                                • End If
                                                                • End If
                                                                • #Clear current PDF document
                                                                • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                • #on macOS we can load the ColorSync profiles
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.InitColorManagement"; $pdf; "DeviceRGB"; 3; "/System/Library/ColorSync/Profiles/Generic Gray Profile.icc"; "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"; "/System/Library/ColorSync/Profiles/Generic CMYK Profile.icc" ) ]
                                                                • Delete All Records [ No dialog ]
                                                                • #Load SVG
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.LoadSVG"; $pdf; SVG::SVG) ]
                                                                • If [ MBS("IsError") ]
                                                                • Show Custom Dialog [ Title: "Failed to load SVG"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                • Exit Script [ ]
                                                                • End If
                                                                • Set Variable [ $errors; Value:MBS("DynaPDF.ErrLogMessages"; $pdf) ]
                                                                • If [ Length ( $errors ) > 10 ]
                                                                • Show Custom Dialog [ Title: "Error Log"; Message: $errors; Default Button: “OK”, Commit: “Yes” ]
                                                                • End If
                                                                • #we check how many images are there and loop to show them all
                                                                • Set Variable [ $symbolCount; Value:MBS("DynaPDF.GetSVGSymbolCount"; $pdf) ]
                                                                • If [ MBS("IsError") or $symbolCount = 0 ]
                                                                • Show Custom Dialog [ Title: "Failed to load SVG"; Default Button: “OK”, Commit: “Yes” ]
                                                                • Exit Script [ ]
                                                                • End If
                                                                • Set Variable [ $i; Value:0 ]
                                                                • If [ $i < $symbolCount ]
                                                                • Loop [ Flush: Always ]
                                                                • #Check the name of thw symbol and query the size
                                                                • Set Variable [ $symbolName; Value:MBS("DynaPDF.GetSVGSymbolName"; $pdf; $i) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                • Set Variable [ $SizeJSON; Value:MBS("DynaPDF.GetSVGSize"; $pdf; $symbolName) ]
                                                                • Set Variable [ $Width; Value:Round(JSONGetElement ( $SizeJSON ; "width" ); 0) ]
                                                                • Set Variable [ $Height; Value:Round(JSONGetElement ( $SizeJSON ; "height" ); 0) ]
                                                                • If [ $Width < 500 or $Height < 500 ]
                                                                • #double size for small ones
                                                                • Set Variable [ $width; Value:$width * 2 ]
                                                                • Set Variable [ $height; Value:$height * 2 ]
                                                                • End If
                                                                • #we size the page and place the SVG image
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $width) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $height) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.InsertSVG"; $pdf; 0; 0; $width; $height; $symbolName) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                • Set Variable [ $page; Value:MBS("DynaPDF.GetPageCount"; $pdf) ]
                                                                • #Create a record and save rendered image
                                                                • New Record/Request
                                                                • Set Field [ SVG::Identifier; $symbolName ]
                                                                • Set Field [ SVG::Width; $Width ]
                                                                • Set Field [ SVG::Height; $Height ]
                                                                • Set Field [ SVG::Image; MBS("DynaPDF.RenderPage"; $pdf; $page; 300; 0; 0; "Default"; "RGBA"; "Flate"; "PNG"; "page.png") ]
                                                                • Commit Records/Requests [ No dialog ]
                                                                • #next
                                                                • Set Variable [ $i; Value:$i + 1 ]
                                                                • Exit Loop If [ $i ≥ $symbolCount ]
                                                                • End Loop
                                                                • End If
                                                                • #Cleanup
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                Fields used in this script
                                                                Scripts used in this script
                                                                Layouts used in this script
                                                                  Tables used in this script
                                                                  Table occurrences used by this script
                                                                  Custom Functions used by this script
                                                                    Custom menu set used by this script

                                                                      Previous Script: [Render SVG] Next Script: [Clear]
                                                                      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
                                                                        • Set Variable [ $path; Value:Substitute ( $path; "/New Examples"; "/Examples/DynaPDF") ]
                                                                        • 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 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
                                                                                          • Delete All Records [ No dialog ]
                                                                                          • Set Field [ SVG::SVG; "" ]
                                                                                          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: SVG

                                                                                                  Used functions: