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

MBS FileMaker Plugin Example Databases

PDF Attachments

All examples are included with download of MBS FileMaker Plugin.

PDF Attachments.fmp12

Overview
Tables2
Relationships1
Layouts2
Scripts7
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
PDF Attachments
9 fields defined, 0 record
PDF Attachments
PDF File
7 fields defined, 1 record
PDF File

Fields

Table Name: PDF Attachments - 9 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
                                        AttachmentNormal, BinaryAuto-Enter:
                                        • Allow editing
                                        Validation:
                                        • Only during data entry
                                        Storage:
                                        • Repetitions: 1
                                            NameNormal, TextAuto-Enter: Validation:
                                            • Only during data entry
                                            Storage:
                                            • Repetitions: 1
                                            • Indexing: None
                                            • Automatically create indexes as needed
                                            • Index Language: German
                                                SizeNormal, NumberAuto-Enter: Validation:
                                                • Only during data entry
                                                Storage:
                                                • Repetitions: 1
                                                • Indexing: None
                                                • Automatically create indexes as needed
                                                • Index Language: German
                                                      PDF Document RefNormal, TextAuto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: Minimal
                                                      • Automatically create indexes as needed
                                                      • Index Language: German

                                                        Table Name: PDF File - 7 Fields
                                                        Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
                                                        PrimaryKeyNormal, TextAuto-Enter:
                                                        • Context table: PDF File
                                                          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
                                                            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
                                                                                            Input PDFNormal, BinaryAuto-Enter:
                                                                                            • Allow editing
                                                                                            Validation:
                                                                                            • Only during data entry
                                                                                            Storage:
                                                                                            • Repetitions: 1
                                                                                                Output PDFNormal, BinaryAuto-Enter:
                                                                                                • Allow editing
                                                                                                Validation:
                                                                                                • Only during data entry
                                                                                                Storage:
                                                                                                • Repetitions: 1

                                                                                                    Layout Objects: PDF Attachments

                                                                                                    Regular Fields

                                                                                                    Field Name: PDF Attachments::Attachment
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 117 pt
                                                                                                    • Left: 138 pt
                                                                                                    • Bottom: 242 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: PDF Attachments::CreationTimestamp
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 117 pt
                                                                                                    • Left: 603 pt
                                                                                                    • Bottom: 148 pt
                                                                                                    • Right: 856 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: PDF Attachments::Name
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 152 pt
                                                                                                    • Left: 603 pt
                                                                                                    • Bottom: 183 pt
                                                                                                    • Right: 856 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: PDF Attachments::Size
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 187 pt
                                                                                                    • Left: 603 pt
                                                                                                    • Bottom: 218 pt
                                                                                                    • Right: 856 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: PDF Attachments::PDF Document Ref
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 222 pt
                                                                                                    • Left: 603 pt
                                                                                                    • Bottom: 253 pt
                                                                                                    • Right: 856 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

                                                                                                    Layout Objects: PDF File

                                                                                                    Regular Fields

                                                                                                    Field Name: PDF File::Input PDF
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 131 pt
                                                                                                    • Left: 153 pt
                                                                                                    • Bottom: 256 pt
                                                                                                    • Right: 406 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: PDF File::Output PDF
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 131 pt
                                                                                                    • Left: 608 pt
                                                                                                    • Bottom: 256 pt
                                                                                                    • Right: 861 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: PDF Attachments::Attachment
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 299 pt
                                                                                                    • Left: 44 pt
                                                                                                    • Bottom: 385 pt
                                                                                                    • Right: 265 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Field Format:
                                                                                                    • Edit Box
                                                                                                    Field Behavior:
                                                                                                    • Allow field to be entered: In Find mode
                                                                                                    • Touch keyboard type: Default for Data Type
                                                                                                    • Go to next field using: Tab key
                                                                                                    No

                                                                                                    Field Name: PDF Attachments::Name
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 299 pt
                                                                                                    • Left: 273 pt
                                                                                                    • Bottom: 330 pt
                                                                                                    • Right: 618 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Field Format:
                                                                                                    • Edit Box
                                                                                                    Field Behavior:
                                                                                                    • Allow field to be entered: In Find mode
                                                                                                    • Touch keyboard type: Default for Data Type
                                                                                                    • Go to next field using: Tab key
                                                                                                    Yes

                                                                                                    Field Name: PDF Attachments::Size
                                                                                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                    • Top: 338 pt
                                                                                                    • Left: 273 pt
                                                                                                    • Bottom: 369 pt
                                                                                                    • Right: 617 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Field Format:
                                                                                                    • Edit Box
                                                                                                    Field Behavior:
                                                                                                    • Allow field to be entered: In Find mode
                                                                                                    • Touch keyboard type: Default for Data Type
                                                                                                    • Go to next field using: Tab key
                                                                                                    Yes

                                                                                                    Buttons

                                                                                                    Button PropertiesCoordinatesScript/Script Step
                                                                                                      Type:
                                                                                                    • Text: Add Attachment
                                                                                                    • Top: 295 pt
                                                                                                    • Left: 669 pt
                                                                                                    • Bottom: 330 pt
                                                                                                    • Right: 922 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Perform Script [ “Add Attachment” ]

                                                                                                    Scripts:


                                                                                                    Button PropertiesCoordinatesScript/Script Step
                                                                                                      Type:
                                                                                                    • Text: Attach attachments
                                                                                                    • Top: 190 pt
                                                                                                    • Left: 423 pt
                                                                                                    • Bottom: 225 pt
                                                                                                    • Right: 591 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Perform Script [ “Add Attachments” ]

                                                                                                    Scripts:


                                                                                                    Button PropertiesCoordinatesScript/Script Step
                                                                                                      Type:
                                                                                                    • Text: Import
                                                                                                    • Top: 190 pt
                                                                                                    • Left: 29 pt
                                                                                                    • Bottom: 225 pt
                                                                                                    • Right: 136 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Perform Script [ “Import PDF” ]

                                                                                                    Scripts:


                                                                                                    Button PropertiesCoordinatesScript/Script Step
                                                                                                      Type:
                                                                                                    • Text: Export
                                                                                                    • Top: 190 pt
                                                                                                    • Left: 878 pt
                                                                                                    • Bottom: 225 pt
                                                                                                    • Right: 985 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Perform Script [ “Export PDF” ]

                                                                                                    Scripts:


                                                                                                    Button PropertiesCoordinatesScript/Script Step
                                                                                                      Type:
                                                                                                    • Text: Extract attachments
                                                                                                    • Top: 233 pt
                                                                                                    • Left: 423 pt
                                                                                                    • Bottom: 268 pt
                                                                                                    • Right: 591 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Perform Script [ “Extract Attachments” ]

                                                                                                    Scripts:


                                                                                                    Portals

                                                                                                    Portal PropertiesCoordinatesFieldsOptions
                                                                                                    • Top: 294 pt
                                                                                                    • Left: 39 pt
                                                                                                    • Bottom: 746 pt
                                                                                                    • Right: 651 pt
                                                                                                    • Anchoring: Left, Top
                                                                                                    Field Objects
                                                                                                    • Sort records: Off
                                                                                                    • Filter calculation: None
                                                                                                    • Initial Row: 1
                                                                                                    • Number of Rows: 5
                                                                                                    • Show vertical scroll bar
                                                                                                    • Allow deletion of portal records

                                                                                                    Script Hierarchy

                                                                                                    Add Attachment
                                                                                                    InitDynaPDF
                                                                                                    Import PDF
                                                                                                    Export PDF
                                                                                                    Clear
                                                                                                    Add Attachments
                                                                                                    Extract Attachments

                                                                                                    Next Script: [InitDynaPDF]
                                                                                                    Script NameAdd Attachment
                                                                                                    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
                                                                                                      • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                      • Set Variable [ $PrimaryKey; Value:PDF File::PrimaryKey ]
                                                                                                      • Insert File [ $file ] [ Storage method: Let user choose ] [ Display content ] [ Compression: Never compress ]
                                                                                                      • If [ Get(LastError) ≠ 0 ]
                                                                                                      • Exit Script [ ]
                                                                                                      • End If
                                                                                                      • If [ IsEmpty ( $file ) ]
                                                                                                      • #nothing?
                                                                                                      • Else
                                                                                                      • Go to Layout [ “PDF Attachments” (PDF Attachments) ]
                                                                                                      • New Record/Request
                                                                                                      • Set Field [ PDF Attachments::PDF Document Ref; $PrimaryKey ]
                                                                                                      • Set Field [ PDF Attachments::Attachment; $file ]
                                                                                                      • Commit Records/Requests [ No dialog ]
                                                                                                      • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                      • 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: [Add Attachment]Next Script: [Import 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:"Pro" // put your key here or leave empty for demo. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                                                                                                              • If [ $r ≠ "OK" ]
                                                                                                              • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                              • Halt Script
                                                                                                              • End If
                                                                                                              Fields used in this script
                                                                                                                Scripts used in this script
                                                                                                                  Layouts used in this script
                                                                                                                    Tables used in this script
                                                                                                                      Table occurrences used by this script
                                                                                                                        Custom Functions used by this script
                                                                                                                          Custom menu set used by this script

                                                                                                                            Previous Script: [InitDynaPDF]Next Script: [Export PDF]
                                                                                                                            Script NameImport 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
                                                                                                                              • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                                              • Go to Field [ PDF File::Input PDF ]
                                                                                                                              • Insert File [ PDF File::Input PDF ] [ Filters ] [ "PDF Files": ( *.pdf ) ] [ Storage method: Let user choose ] [ Display content ] [ Compression: Never compress ]
                                                                                                                              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: [Import PDF]Next Script: [Clear]
                                                                                                                                    Script NameExport 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
                                                                                                                                      • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                                                      • Export Field Contents [ PDF File::Output PDF; Create folders:Yes ]
                                                                                                                                      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: [Export PDF]Next Script: [Add Attachments]
                                                                                                                                            Script NameClear
                                                                                                                                            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
                                                                                                                                                • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                                                                • Truncate Table [ No dialog; Table: “PDF Attachments” ]
                                                                                                                                                • Truncate Table [ No dialog; Table: “PDF File” ]
                                                                                                                                                • New Record/Request
                                                                                                                                                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: [Clear]Next Script: [Extract Attachments]
                                                                                                                                                            Script NameAdd Attachments
                                                                                                                                                            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
                                                                                                                                                              • #Initialize DynaPDF if needed
                                                                                                                                                              • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                              • Perform Script [ “InitDynaPDF” ]
                                                                                                                                                              • End If
                                                                                                                                                              • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                                                                              • #Clear current PDF document
                                                                                                                                                              • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                                                                              • #Load PDF from container
                                                                                                                                                              • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; PDF File::Input PDF) ]
                                                                                                                                                              • #import a page
                                                                                                                                                              • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
                                                                                                                                                              • Go to Related Record [ From table: “PDF Attachments”; Using layout: “PDF Attachments” (PDF Attachments) ] [ Show only related records ]
                                                                                                                                                              • If [ Get(FoundCount) > 0 ]
                                                                                                                                                              • Go to Record/Request/Page [ First ]
                                                                                                                                                              • Loop [ Flush: Always ]
                                                                                                                                                              • If [ not IsEmpty ( PDF Attachments::Attachment ) ]
                                                                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.AttachFileContainer"; $pdf; PDF Attachments::Attachment; PDF Attachments::Name ) ]
                                                                                                                                                              • End If
                                                                                                                                                              • Go to Record/Request/Page [ Next; Exit after last ]
                                                                                                                                                              • End Loop
                                                                                                                                                              • End If
                                                                                                                                                              • #we can add a button to open first attachment
                                                                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.EditPage"; $PDF; 1) ]
                                                                                                                                                              • Set Variable [ $FirstFilename; Value:MBS( "DynaPDF.GetEmbeddedFile"; $PDF; 0; "name") ]
                                                                                                                                                              • #we create an action to open an embedded file by name
                                                                                                                                                              • Set Variable [ $Action; Value:MBS( "DynaPDF.CreateGoToEAction"; $pdf; "Child"; ""; 0; $FirstFilename; ""; 1; 1 ) ]
                                                                                                                                                              • #we create a button to open that embedded file
                                                                                                                                                              • Set Variable [ $button; Value:MBS( "DynaPDF.CreateButton"; $pdf; "OpenAttachment"; "Open First Attachment"; -1; 100; 100; 100; 20 ) ]
                                                                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.AddActionToObj"; $pdf; "Field"; "OnMouseUp"; $Action; $Button ) ]
                                                                                                                                                              • Set Variable [ $r; Value:MBS( "DynaPDF.EndPage"; $PDF) ]
                                                                                                                                                              • #save
                                                                                                                                                              • Go to Layout [ original layout ]
                                                                                                                                                              • Set Field [ PDF File::Output PDF; MBS( "DynaPDF.Save"; $pdf; GetAsText ( PDF File::Input PDF ) ) ]
                                                                                                                                                              • #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: [Add Attachments]
                                                                                                                                                                  Script NameExtract Attachments
                                                                                                                                                                  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
                                                                                                                                                                    • #Initialize DynaPDF if needed
                                                                                                                                                                    • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                                    • Perform Script [ “InitDynaPDF” ]
                                                                                                                                                                    • End If
                                                                                                                                                                    • Go to Layout [ “PDF File” (PDF File) ]
                                                                                                                                                                    • #Clear current PDF document
                                                                                                                                                                    • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                                                                                    • #Load PDF from container
                                                                                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; PDF File::Input PDF) ]
                                                                                                                                                                    • #import a page
                                                                                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
                                                                                                                                                                    • Set Variable [ $count; Value:MBS( "DynaPDF.GetEmbeddedFileCount"; $PDF ) ]
                                                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                                                    • Show Custom Dialog [ Title: "MBS Error"; Message: $count; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                    • Else If [ $count = 0 ]
                                                                                                                                                                    • Show Custom Dialog [ Message: "No attachments!"; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                    • Else
                                                                                                                                                                    • Set Variable [ $primaryKey; Value:PDF File::PrimaryKey ]
                                                                                                                                                                    • Go to Layout [ “PDF Attachments” (PDF Attachments) ]
                                                                                                                                                                    • Set Variable [ $index; Value:0 ]
                                                                                                                                                                    • Loop [ Flush: Always ]
                                                                                                                                                                    • #your script steps here
                                                                                                                                                                    • Set Variable [ $name; Value:MBS( "DynaPDF.GetEmbeddedFile"; $PDF; $Index; "name" ) ]
                                                                                                                                                                    • Set Variable [ $file; Value:MBS( "DynaPDF.GetEmbeddedFileAsContainer"; $PDF; $Index ) ]
                                                                                                                                                                    • New Record/Request
                                                                                                                                                                    • Set Field [ PDF Attachments::Attachment; $file ]
                                                                                                                                                                    • Set Field [ PDF Attachments::Name; $name ]
                                                                                                                                                                    • Set Field [ PDF Attachments::PDF Document Ref; $primaryKey ]
                                                                                                                                                                    • Commit Records/Requests [ No dialog ]
                                                                                                                                                                    • #next
                                                                                                                                                                    • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                                                    • Exit Loop If [ $index ≥ $count ]
                                                                                                                                                                    • End Loop
                                                                                                                                                                    • End If
                                                                                                                                                                    • #Cleanup
                                                                                                                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                                                                                    • Go to Layout [ original layout ]
                                                                                                                                                                    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: PDF Attachments

                                                                                                                                                                        Used functions: