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

MBS FileMaker Plugin Example Databases

Book Creation

All examples are included with download of MBS FileMaker Plugin.

Book Creation.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts4
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
BookPDF
15 fields defined, 10 records
BookPDF

Fields

Table Name: BookPDF - 15 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
_BookIDNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: English
          ChapterNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: English
              TextNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: English
                  Book TitleNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Global
                  • Repetitions: 1
                  • Index Language: English
                      PDF FilenameNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: English
                            CopyrightNormal, TextAuto-Enter:
                            • Allow editing
                            Validation:
                            • Only during data entry
                            Storage:
                            • Global
                            • Repetitions: 1
                            • Index Language: English
                                    Publishing DisclaimerNormal, TextAuto-Enter:
                                    • Allow editing
                                    Validation:
                                    • Only during data entry
                                    Storage:
                                    • Global
                                    • Repetitions: 1
                                    • Index Language: English
                                            PrefaceNormal, TextAuto-Enter:
                                            • Allow editing
                                            Validation:
                                            • Only during data entry
                                            Storage:
                                            • Global
                                            • Repetitions: 1
                                            • Index Language: English
                                                    Book PDFNormal, BinaryAuto-Enter:
                                                    • Allow editing
                                                    Validation:
                                                    • Only during data entry
                                                    Storage:
                                                    • Global
                                                    • Repetitions: 1
                                                        Before Chapter PDFNormal, BinaryAuto-Enter:
                                                        • Allow editing
                                                        Validation:
                                                        • Only during data entry
                                                        Storage:
                                                        • Repetitions: 1
                                                            After Chapter PDFNormal, BinaryAuto-Enter:
                                                            • Allow editing
                                                            Validation:
                                                            • Only during data entry
                                                            Storage:
                                                            • Repetitions: 1
                                                                FirstPages PDFNormal, BinaryAuto-Enter:
                                                                • Allow editing
                                                                Validation:
                                                                • Only during data entry
                                                                Storage:
                                                                • Global
                                                                • Repetitions: 1
                                                                    Before Content PDFNormal, BinaryAuto-Enter:
                                                                    • Allow editing
                                                                    Validation:
                                                                    • Only during data entry
                                                                    Storage:
                                                                    • Global
                                                                    • Repetitions: 1
                                                                        After Content PDFNormal, BinaryAuto-Enter:
                                                                        • Allow editing
                                                                        Validation:
                                                                        • Only during data entry
                                                                        Storage:
                                                                        • Global
                                                                        • Repetitions: 1
                                                                            ISBNNormal, TextAuto-Enter:
                                                                            • Allow editing
                                                                            Validation:
                                                                            • Only during data entry
                                                                            Storage:
                                                                            • Global
                                                                            • Repetitions: 1
                                                                            • Index Language: English

                                                                                Layout Objects: Chapeters

                                                                                Regular Fields

                                                                                Field Name: BookPDF::Chapter
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 175 pt
                                                                                • Left: 138 pt
                                                                                • Bottom: 227 pt
                                                                                • Right: 1026 pt
                                                                                • Anchoring: Left and Right, 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: BookPDF::Text
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 244 pt
                                                                                • Left: 138 pt
                                                                                • Bottom: 779 pt
                                                                                • Right: 1026 pt
                                                                                • Anchoring: Left and Right, 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: BookPDF::Book Title
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 18 pt
                                                                                • Left: 104 pt
                                                                                • Bottom: 95 pt
                                                                                • Right: 522 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: BookPDF::Book PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 998 pt
                                                                                • Left: 788 pt
                                                                                • Bottom: 1123 pt
                                                                                • Right: 1041 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: BookPDF::Before Chapter PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 796 pt
                                                                                • Left: 295 pt
                                                                                • Bottom: 921 pt
                                                                                • Right: 548 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: BookPDF::After Chapter PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 796 pt
                                                                                • Left: 773 pt
                                                                                • Bottom: 921 pt
                                                                                • Right: 1026 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: BookPDF::FirstPages PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 998 pt
                                                                                • Left: 8 pt
                                                                                • Bottom: 1123 pt
                                                                                • Right: 261 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: BookPDF::Before Content PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 998 pt
                                                                                • Left: 268 pt
                                                                                • Bottom: 1123 pt
                                                                                • Right: 521 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: BookPDF::After Content PDF
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 998 pt
                                                                                • Left: 528 pt
                                                                                • Bottom: 1123 pt
                                                                                • Right: 781 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: BookPDF::ISBN
                                                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                • Top: 64 pt
                                                                                • Left: 537 pt
                                                                                • Bottom: 95 pt
                                                                                • Right: 753 pt
                                                                                • Anchoring: Left, Top
                                                                                Field Format:
                                                                                • Edit Box
                                                                                Field Behavior:
                                                                                • Allow field to be entered: In Find mode, In Browse mode
                                                                                • Touch keyboard type: Default for Data Type
                                                                                • Go to next field using: Tab key
                                                                                No

                                                                                Buttons

                                                                                Button PropertiesCoordinatesScript/Script Step
                                                                                  Type:
                                                                                • Text: Make Book
                                                                                • Top: 16 pt
                                                                                • Left: 877 pt
                                                                                • Bottom: 47 pt
                                                                                • Right: 1026 pt
                                                                                • Anchoring: Left and Right, Top
                                                                                Perform Script [ “Make PDF Book” ]

                                                                                Scripts:


                                                                                Button PropertiesCoordinatesScript/Script Step
                                                                                  Type:
                                                                                • Text: Make Cover
                                                                                • Top: 64 pt
                                                                                • Left: 877 pt
                                                                                • Bottom: 95 pt
                                                                                • Right: 1026 pt
                                                                                • Anchoring: Left and Right, Top
                                                                                Perform Script [ “Make Book Cover” ]

                                                                                Scripts:


                                                                                Script Hierarchy

                                                                                InitDynaPDF
                                                                                Make PDF Book
                                                                                Make Book Cover
                                                                                Clear

                                                                                Next Script: [Make PDF Book]
                                                                                Script NameInitDynaPDF
                                                                                Run script with full access privilegesOff
                                                                                Siri Shortcut VisibleOff
                                                                                Include In MenuNo
                                                                                Layouts that use this script
                                                                                  Scripts that use this script
                                                                                  Script Definition
                                                                                  Script Steps
                                                                                  • #Locate DynaPDF library
                                                                                  • #you can have libraries in container and export at runtime to folder of your choice.
                                                                                  • #Or install library somewhere and pass path.
                                                                                  • #If library is in same folder as plugin, you can only pass only file name.
                                                                                  • If [ MBS("IsServer") ]
                                                                                  • #Put the path you use for your server here:
                                                                                  • If [ Get(SystemPlatform) = -2 ]
                                                                                  • #Server on Windows
                                                                                  • Set Variable [ $path; Value:"C:\Programs\FileMaker Server\dynapdf.dll" ]
                                                                                  • Else If [ MBS("IsLinux") ]
                                                                                  • #Server on Linux for FileMaker Cloud
                                                                                  • Set Variable [ $path; Value:"/opt/FileMaker/FileMaker Server/dynapdf.linux.so" ]
                                                                                  • Else
                                                                                  • #Server on Mac
                                                                                  • Set Variable [ $path; Value: "/Library/FileMaker Server/dynapdf.dylib" ]
                                                                                  • End If
                                                                                  • Else
                                                                                  • #For desktop and our examples we look in same folder as database:
                                                                                  • Set Variable [ $databasePath; Value:Get(FilePath) ]
                                                                                  • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
                                                                                  • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
                                                                                  • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
                                                                                  • If [ Get(SystemPlatform) = -2 ]
                                                                                  • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                                                                                  • #plugin will look for dynapdf.dll and if not found also for dynapdf.dll (64-bit) and dynapdf32.dll (32-bit).
                                                                                  • Else
                                                                                  • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                                                                                  • #Mac dylib is usually 32 and 64 bit together.
                                                                                  • End If
                                                                                  • End If
                                                                                  • #You can test for free.
                                                                                  • #If you like to get a dynapdf license, please follow links on our pricing page:
                                                                                  • #https://www.monkeybreadsoftware.de/filemaker/pricing.shtml
                                                                                  • Set Variable [ $LicenseKey; Value:"" // put your key here or leave empty for demo. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                                                                                  • If [ $r ≠ "OK" ]
                                                                                  • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                                                  • Halt Script
                                                                                  • End If
                                                                                  Fields used in this script
                                                                                    Scripts used in this script
                                                                                      Layouts used in this script
                                                                                        Tables used in this script
                                                                                          Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Previous Script: [InitDynaPDF]Next Script: [Make Book Cover]
                                                                                                Script NameMake PDF Book
                                                                                                Run script with full access privilegesOff
                                                                                                Siri Shortcut VisibleOff
                                                                                                Include In MenuYes
                                                                                                Layouts that use this script
                                                                                                Scripts that use this script
                                                                                                  Script Definition
                                                                                                  Script Steps
                                                                                                  • Set Variable [ $r; Value:MBS("Trace") ]
                                                                                                  • #Initialize DynaPDF if needed
                                                                                                  • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                  • Perform Script [ “InitDynaPDF” ]
                                                                                                  • End If
                                                                                                  • Set Variable [ $OneInch; Value:72 ]
                                                                                                  • Set Variable [ $FontName; Value:"Avenir" ]
                                                                                                  • #Clear current PDF document
                                                                                                  • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                  • #Calculate the sizes for pages and text area
                                                                                                  • Set Variable [ $PageWidth; Value:7 * $OneInch ]
                                                                                                  • Set Variable [ $PageHeight; Value:10 * $OneInch ]
                                                                                                  • Set Variable [ $TextWidth; Value:$PageWidth - 2 * $OneInch ]
                                                                                                  • Set Variable [ $TextHeight; Value:$PageHeight - 2 * $OneInch ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                  • Set Variable [ $PosX; Value:$OneInch ]
                                                                                                  • Set Variable [ $PosY; Value:$PageHeight - $OneInch ]
                                                                                                  • #create table for index page
                                                                                                  • Set Variable [ $table; Value:MBS("DynaPDF.Table.Create"; $pdf; 50; 2; $TextWidth; 20) ]
                                                                                                  • // Set Variable [ $r; Value:MBS("DynaPDF.Table.SetBorderWidth"; $table; -1; -1; 1; 1; 1; 1) ]
                                                                                                  • // Set Variable [ $r; Value:MBS("DynaPDF.Table.SetGridWidth"; $table; 1; 1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetFont"; $table; -1; -1; $FontName; 0; 1; "unicode") ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetFontSize"; $table; -1; -1; 13) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Table.SetColWidth"; $Table; 0; 450; 1 ) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Table.SetColWidth"; $Table; 1; 50;1 ) ]
                                                                                                  • #add cover pages if needed
                                                                                                  • If [ not IsEmpty ( BookPDF::FirstPages PDF ) ]
                                                                                                  • Set Variable [ $destpage; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; BookPDF::FirstPages PDF) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ]
                                                                                                  • End If
                                                                                                  • #you may want to have a title page generated
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                  • #Write header
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 20) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $pageHeight - 2 * $OneInch; $TextWidth; -1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; BookPDF::Book Title) ]
                                                                                                  • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                  • #Write Author
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 15) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $y; $TextWidth; -1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; "John Jones") ]
                                                                                                  • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                  • #Write Copyright
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 12) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $y; $TextWidth; -1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; "© 2024, USA") ]
                                                                                                  • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                  • #End page
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • #create dummy page for index
                                                                                                  • Set Variable [ $FoundCount; Value:Get(FoundCount) ]
                                                                                                  • Set Variable [ $IndexPageStart; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                  • Loop [ Flush: Always ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • Set Variable [ $FoundCount; Value:$FoundCount - 25 ]
                                                                                                  • Exit Loop If [ $FoundCount < 0 ]
                                                                                                  • End Loop
                                                                                                  • #also add a bookmark
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.AddBookmark"; $pdf; "Table of Contents"; -1; $IndexPageStart) ]
                                                                                                  • #add legal pages
                                                                                                  • If [ not IsEmpty ( BookPDF::Before Content PDF ) ]
                                                                                                  • Set Variable [ $destpage; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; BookPDF::Before Content PDF) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ]
                                                                                                  • End If
                                                                                                  • Go to Record/Request/Page [ First ]
                                                                                                  • Loop [ Flush: Always ]
                                                                                                  • Set Variable [ $PageCount; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • #extra pages before chapter
                                                                                                  • If [ not IsEmpty ( BookPDF::Before Chapter PDF ) ]
                                                                                                  • Set Variable [ $destpage; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; BookPDF::Before Chapter PDF) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ]
                                                                                                  • End If
                                                                                                  • #Add page
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                  • #put in a named destination for this new page
                                                                                                  • Set Variable [ $NamedDest; Value:"Chapter" & Get(RecordID) ]
                                                                                                  • Set Variable [ $NamedDestHandle; Value:MBS( "DynaPDF.CreateNamedDest"; $PDF; $NamedDest; $PageCount; "Fit") ]
                                                                                                  • #add table entry
                                                                                                  • Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; BookPDF::Chapter) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "right"; "top"; $PageCount) ]
                                                                                                  • #add click action
                                                                                                  • Set Variable [ $Action; Value:MBS( "DynaPDF.CreateGoToActionEx"; $PDF; $NamedDestHandle) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 0; $action; "Invert" ) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 1; $action; "Invert" ) ]
                                                                                                  • #also add a bookmark
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.AddBookmark"; $pdf; BookPDF::Chapter; -1; $pageCount) ]
                                                                                                  • #Write header
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 15) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $pageHeight - $OneInch; $TextWidth; -1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; BookPDF::Chapter) ]
                                                                                                  • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                  • #Write text
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 0; 13) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $y; $TextWidth; $y - $OneInch) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetLeading"; $PDF; 18 ) // bigger line heights ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.AllowPageBreak"; $pdf; 1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageBreakExpression"; $pdf; "Let ( [ a = MBS( \"DynaPDF.EndPage\"; $pdf); a = MBS( \"DynaPDF.AppendPage\"; $pdf; 1); a = MBS( \"DynaPDF.SetTextRect\"; $pdf; $PosX; $PosY; $TextWidth; $TextHeight ) ]; 0 )") ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "justify"; BookPDF::Text) ]
                                                                                                  • #preserve styles? Then use this...
                                                                                                  • // Set Variable [ $r; Value:MBS("DynaPDF.WriteStyledText"; $pdf; "justify"; BookPDF::Text) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetLeading"; $PDF; 0 ) // auto ]
                                                                                                  • #End page
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • #extra pages after chapter
                                                                                                  • If [ not IsEmpty ( BookPDF::After Chapter PDF ) ]
                                                                                                  • Set Variable [ $destpage; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; BookPDF::After Chapter PDF) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ]
                                                                                                  • End If
                                                                                                  • Go to Record/Request/Page [ Next; Exit after last ]
                                                                                                  • End Loop
                                                                                                  • #Set title
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetDocInfo"; $pdf; "Title"; BookPDF::Book Title) ]
                                                                                                  • #Draw Table
                                                                                                  • Set Variable [ $page; Value:$IndexPageStart ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $page) ]
                                                                                                  • #Write header
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 15) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $pageHeight - $OneInch; $TextWidth; -1) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; BookPDF::Book Title) ]
                                                                                                  • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                  • #Write table
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 0; 12) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; $PosX; $y; $y - $OneInch) ]
                                                                                                  • Loop [ Flush: Always ]
                                                                                                  • Exit Loop If [ MBS("DynaPDF.Table.HaveMore"; $table) ≠ 1 ]
                                                                                                  • #next page
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • Set Variable [ $page; Value:$page + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $page) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; $PosX; $PosY; $TextHeight) ]
                                                                                                  • End Loop
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • #add final pages
                                                                                                  • If [ not IsEmpty ( BookPDF::After Content PDF ) ]
                                                                                                  • Set Variable [ $destpage; Value:MBS("DynaPDF.GetPageCount"; $pdf) + 1 ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; BookPDF::After Content PDF) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ]
                                                                                                  • End If
                                                                                                  • #Add Page Numbers
                                                                                                  • Set Variable [ $PageCount; Value:MBS( "DynaPDF.GetPageCount"; $pdf ) ]
                                                                                                  • Set Variable [ $PageNumber; Value:$IndexPageStart // let's not put numbers on cover pages ]
                                                                                                  • Loop [ Flush: Always ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $PageNumber) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.SetPageCoords"; $PDF; "TopDown" ) ]
                                                                                                  • Set Variable [ $pageWidth; Value:MBS("DynaPDF.GetPageWidth"; $pdf) ]
                                                                                                  • Set Variable [ $pageHeight; Value:MBS("DynaPDF.GetPageHeight"; $pdf) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; 0; 12) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.WriteFTextEx"; $pdf; 50; $pageHeight - 50; $pageWidth-100; 30; "right"; GetAsText($PageNumber) & " of " & $PageCount) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • Set Variable [ $PageNumber; Value:$PageNumber +1 ]
                                                                                                  • Exit Loop If [ $PageNumber > $PageCount ]
                                                                                                  • End Loop
                                                                                                  • #now add a page for ISBN
                                                                                                  • If [ 1 ]
                                                                                                  • Set Variable [ $isbn; Value:BookPDF::ISBN ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                  • Set Variable [ $json; Value:MBS( "DynaPDF.GetDefaultBarcodeParameters" ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "BarcodeType" ; "ISBNX"; JSONString ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "Data" ; $isbn; JSONString ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "PosX" ; 300; JSONNumber ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "PosY" ; $PageHeight - 200; JSONNumber ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "Width" ; 300; JSONNumber ) ]
                                                                                                  • Set Variable [ $json; Value:JSONSetElement ( $json ; "Height" ; 100; JSONNumber ) ]
                                                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.InsertBarcode"; $pdf; $json ) ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                  • End If
                                                                                                  • #Render one page as Picture
                                                                                                  • Set Variable [ $PDFData; Value:MBS("DynaPDF.Save"; $pdf; BookPDF::PDF Filename & ".pdf") ]
                                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                  • #Put in Container
                                                                                                  • Set Field [ BookPDF::Book PDF; $PDFData ]
                                                                                                  • Export Field Contents [ BookPDF::Book PDF; “file:test.pdf”; Automatically open; Create folders:No ]
                                                                                                  Fields used in this script
                                                                                                  Scripts used in this script
                                                                                                  Layouts used in this script
                                                                                                    Tables used in this script
                                                                                                    Table occurrences used by this script
                                                                                                    Custom Functions used by this script
                                                                                                      Custom menu set used by this script

                                                                                                        Previous Script: [Make PDF Book]Next Script: [Clear]
                                                                                                        Script NameMake Book Cover
                                                                                                        Run script with full access privilegesOff
                                                                                                        Siri Shortcut VisibleOff
                                                                                                        Include In MenuYes
                                                                                                        Layouts that use this script
                                                                                                        Scripts that use this script
                                                                                                          Script Definition
                                                                                                          Script Steps
                                                                                                          • Set Variable [ $r; Value:MBS("Trace") ]
                                                                                                          • #Initialize DynaPDF if needed
                                                                                                          • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                          • Perform Script [ “InitDynaPDF” ]
                                                                                                          • End If
                                                                                                          • Set Variable [ $OneInch; Value:72 ]
                                                                                                          • Set Variable [ $FontName; Value:"Avenir" ]
                                                                                                          • #Clear current PDF document
                                                                                                          • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                          • #Calculate the sizes for pages and text area
                                                                                                          • Set Variable [ $PageWidth; Value:7 * $OneInch ]
                                                                                                          • Set Variable [ $PageHeight; Value:10 * $OneInch ]
                                                                                                          • Set Variable [ $TextWidth; Value:$PageWidth - 2 * $OneInch ]
                                                                                                          • Set Variable [ $TextHeight; Value:$PageHeight - 2 * $OneInch ]
                                                                                                          • Set Variable [ $PosX; Value:$OneInch ]
                                                                                                          • Set Variable [ $PosY; Value:$PageHeight - $OneInch ]
                                                                                                          • Set Variable [ $PosX; Value:$PageWidth + $OneInch/2 + $OneInch ]
                                                                                                          • #you may want to have a title page generated
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetPageWidth"; $pdf; $PageWidth * 2 + $OneInch/2 ) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetPageHeight"; $pdf; $PageHeight ) ]
                                                                                                          • #Write header
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 20) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $pageHeight - 2 * $OneInch; $TextWidth; -1) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; BookPDF::Book Title) ]
                                                                                                          • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                          • #Write Author
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 15) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $y; $TextWidth; -1) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; "John Jones") ]
                                                                                                          • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                          • #Write Copyright
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFont"; $pdf; $FontName; 2; 12) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetTextRect"; $pdf; $PosX; $y; $TextWidth; -1) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.WriteFText"; $pdf; "center"; "© 2024, USA") ]
                                                                                                          • Set Variable [ $y; Value:MBS("DynaPDF.GetLastTextPosY"; $pdf) - 20 // a little bit distance ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
                                                                                                          • Set Variable [ $r; Value:MBS ( "DynaPDF.MoveTo" ; $pdf ; $pageWidth; 0) & MBS ( "DynaPDF.LineTo" ; $pdf ; $pageWidth; $pageHeight) ]
                                                                                                          • Set Variable [ $r; Value:MBS ( "DynaPDF.MoveTo" ; $pdf ; $pageWidth + $oneInch/2; 0) & MBS ( "DynaPDF.LineTo" ; $pdf ; $pageWidth + $oneInch/2; $pageHeight) ]
                                                                                                          • Set Variable [ $r; Value:MBS ( "DynaPDF.StrokePath" ; $pdf) ]
                                                                                                          • #now add a page for ISBN
                                                                                                          • Set Variable [ $isbn; Value:BookPDF::ISBN ]
                                                                                                          • Set Variable [ $json; Value:MBS( "DynaPDF.GetDefaultBarcodeParameters" ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "BarcodeType" ; "ISBNX"; JSONString ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "Data" ; $isbn; JSONString ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "PosX" ; 200; JSONNumber ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "PosY" ; 200; JSONNumber ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "Width" ; 300; JSONNumber ) ]
                                                                                                          • Set Variable [ $json; Value:JSONSetElement ( $json ; "Height" ; 100; JSONNumber ) ]
                                                                                                          • Set Variable [ $r; Value:MBS( "DynaPDF.InsertBarcode"; $pdf; $json ) ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                                                          • #Render one page as Picture
                                                                                                          • Set Variable [ $PDFData; Value:MBS("DynaPDF.Save"; $pdf; BookPDF::PDF Filename & ".pdf") ]
                                                                                                          • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                          • #Put in Container
                                                                                                          • Set Field [ BookPDF::Book PDF; $PDFData ]
                                                                                                          • Export Field Contents [ BookPDF::Book PDF; “file:test.pdf”; Automatically open; Create folders:No ]
                                                                                                          Fields used in this script
                                                                                                          Scripts used in this script
                                                                                                          Layouts used in this script
                                                                                                            Tables used in this script
                                                                                                            Table occurrences used by this script
                                                                                                            Custom Functions used by this script
                                                                                                              Custom menu set used by this script

                                                                                                                Previous Script: [Make Book Cover]
                                                                                                                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
                                                                                                                    • Replace Field Contents [ BookPDF::Book PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    • Replace Field Contents [ BookPDF::After Chapter PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    • Replace Field Contents [ BookPDF::After Content PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    • Replace Field Contents [ BookPDF::Before Chapter PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    • Replace Field Contents [ BookPDF::Before Content PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    • Replace Field Contents [ BookPDF::FirstPages PDF; Replace with calculation: "" ] [ No dialog ]
                                                                                                                    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: Book Creation

                                                                                                                            Used functions: