MBS FileMaker Plugin Example Databases

DynaPDF PlaceTemplate

All examples are included with download of MBS FileMaker Plugin.

DynaPDF PlaceTemplate.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts2
Value Lists0
Custom Functions0
Custom Menus33
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
DynaPDF PlaceTemplate
3 fields defined, 1 record
DynaPDF PlaceTemplate

Fields

Table Name: DynaPDF PlaceTemplate - 3 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputPDFNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      InputPictureNormal, BinaryAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
          OutputPDFNormal, BinaryAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1

              Layout Objects: DynaPDF PlaceTemplate

              Regular Fields

              Field Name: DynaPDF PlaceTemplate::InputPDF
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 24 pt
              • Left: 138 pt
              • Bottom: 149 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: System Default
              • Go to next field using: Tab key
              No

              Field Name: DynaPDF PlaceTemplate::InputPicture
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 150 pt
              • Left: 138 pt
              • Bottom: 275 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: System Default
              • Go to next field using: Tab key
              No

              Field Name: DynaPDF PlaceTemplate::OutputPDF
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 276 pt
              • Left: 138 pt
              • Bottom: 401 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: System Default
              • Go to next field using: Tab key
              No

              Group Buttons

              Button PropertiesCoordinatesScript/Script Step
                Type:
              • Text: Create PDF
                Additional Properties:
              • Change to hand cursor over button
              • Rectangular
              • Top: 30 pt
              • Left: 426 pt
              • Bottom: 55 pt
              • Right: 541 pt
              • Anchoring: Left, Top
              Perform Script [ “Run” ]

              Scripts:


              Script Hierarchy

              InitDynaPDF
              Run

              Next Script: [Run]
              Script NameInitDynaPDF
              Run script with full access privilegesOff
              Include In MenuYes
              Layouts that use this script
                Scripts that use this script
                Script Definition
                Script Steps
                • #Locate DynaPDF library
                • 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]
                              Script NameRun
                              Run script with full access privilegesOff
                              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") ]
                                • #Load PDF from container
                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; DynaPDF PlaceTemplate::InputPDF) ]
                                • #Import first page as template
                                • Set Variable [ $template; Value:MBS("DynaPDF.ImportPageAsTemplate"; $pdf; 1) ]
                                • #Make new page and place PDF there in original size (0/0) in position (0/0)
                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 0; 0; 0; 0) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                • #Make new page and place PDF there in size (300/200) in position (100/100)
                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 100; 100; 200; 300) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                • #Same, but a little bit rotated (10°)
                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.SaveGraphicState"; $pdf) ]
                                • #Rotation can be difficult. You need to move first to some center, rotate there and go back
                                • Set Variable [ $r; Value:MBS("DynaPDF.TranslateCoords"; $pdf; MBS("DynaPDF.GetPageWidth"; $pdf)/2; MBS("DynaPDF.GetPageHeight"; $pdf)/2) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.RotateCoords"; $pdf; 10; 0; 0) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.TranslateCoords"; $pdf; -MBS("DynaPDF.GetPageWidth"; $pdf)/2; -MBS("DynaPDF.GetPageHeight"; $pdf)/2) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 100; 100; 200; 300) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.RestoreGraphicState"; $pdf) ]
                                • #And put another copy on top of that with another 10°
                                • Set Variable [ $r; Value:MBS("DynaPDF.SaveGraphicState"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.TranslateCoords"; $pdf; MBS("DynaPDF.GetPageWidth"; $pdf)/2; MBS("DynaPDF.GetPageHeight"; $pdf)/2) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.RotateCoords"; $pdf; 20; 0; 0) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.TranslateCoords"; $pdf; -MBS("DynaPDF.GetPageWidth"; $pdf)/2; -MBS("DynaPDF.GetPageHeight"; $pdf)/2) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 100; 100; 200; 300) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.RestoreGraphicState"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                • #Make new page and place 4 PDFs there
                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                • #for that we need to find out the size of imported page
                                • Set Variable [ $bounds; Value:MBS("DynaPDF.GetImportPageBounds"; $pdf; 1; "MediaBox") ]
                                • Set Variable [ $bounds; Value:Substitute(Substitute($bounds; ","; ""); "."; ",") ]
                                • Set Variable [ $boundsLeft; Value:GetAsNumber(MiddleValues ( $bounds ; 1 ; 1 )) ]
                                • Set Variable [ $boundsTop; Value:GetAsNumber(MiddleValues ( $bounds ; 2 ; 1 )) ]
                                • Set Variable [ $boundsRight; Value:GetAsNumber(MiddleValues ( $bounds ; 3 ; 1 )) ]
                                • Set Variable [ $boundsBottom; Value:GetAsNumber(MiddleValues ( $bounds ; 4 ; 1 )) ]
                                • Set Variable [ $w; Value:($boundsRight - $boundsLeft)/2 ]
                                • Set Variable [ $h; Value:Abs($boundsBottom - $boundsTop)/2 ]
                                • #And place 4 copies
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 0; 0; $w; $h) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; $w; 0; $w; $h) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; $w; $h; $w; $h) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 0; $h; $w; $h) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                • #Put image on top of a template
                                • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.PlaceTemplate"; $pdf; $template; 0; 0; 0; 0) ]
                                • #read image details
                                • Set Variable [ $r; Value:"/*MBS(\"DynaPDF.ReadImageFormat\"; $pdf; Merge PDFs::InputImage)*/" ]
                                • Set Variable [ $ImageWidth; Value:GetAsNumber (LeftValues ( $r ; 1 )) ]
                                • Set Variable [ $imageHeight; Value:GetAsNumber (MiddleValues ( $r ; 2; 1 )) ]
                                • Set Variable [ $BitsPerPixel; Value:GetAsNumber (MiddleValues ( $r ;3; 1 )) ]
                                • #no recompression! and if we must, please with no compression.
                                • Set Variable [ $r; Value:MBS("DynaPDF.SetSaveNewImageFormat"; $pdf; 0) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.SetCompressionFilter"; $pdf; "flate") ]
                                • #calculate position and a nice size
                                • Set Variable [ $x; Value:100 ]
                                • Set Variable [ $y; Value:100 ]
                                • Set Variable [ $w; Value:300 ]
                                • Set Variable [ $h; Value:300 / $ImageWidth * $ImageHeight ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.InsertImage"; $pdf; DynaPDF PlaceTemplate::InputPicture; $x; $y; $w; $h) ]
                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                • #done, save to container
                                • Set Field [ DynaPDF PlaceTemplate::OutputPDF; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ]
                                • #done, save to container
                                • 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

                                      Download example: DynaPDF PlaceTemplate

                                      Used functions:




                                      Links
                                      MBS Xojo Plugins