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


Initializes the DynaPDF functions in the MBS Plugin.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 3.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.Initialize"; LibraryPath { ; SerialNumber } )   More


Parameter Description Example Flags
LibraryPath The native file path to the DynaPDF library file.
Can be empty for default file name with file in same folder as plugin.
SerialNumber The DynaPDF serial number.
License key is not directly checked for expiration as that happens later with DynaPDF.New function.

If you don't provide a serial number, you run DynaPDF in demo mode.
You can pass "Starter", "Lite" or "Pro" to use demo license in this level.
$serial Optional



Initializes the DynaPDF functions in the MBS Plugin.
You need to pass the path to the dynapdf library and the plugin loads it.
The DynaPDF dll/dylib files are included with the plugin archive in the examples folder. Please check our example projects on sample scripts to load and initialize DynaPDF.
If you provide a serial number, the plugin will also register DynaPDF. If you need a serial number, please order one from Monkeybread Software.
Starting with version 4.4, you can pass just the filename of library and the plugin finds it in the Extensions folder or in FileMaker's application folder.

Pro license is required for the following functions:

Lite is required for:

And all functions relaying on those functions internally.

For testing you can pass "Lite", "Pro" or "Starter" for the license key. DynaPDF runs in demo mode, but will returners if you use functions which are not covered by the license.

Windows error 193 means that 64-bit FileMaker tried to load 32-bit library or 32-bit FileMaker tried to load 64-bit library. The bit level must match between app and library. For macOS the error message will tell you about wrong architecture.

If you download the library files directly from website, you can use the libdynapdf.dylib, or dynapdf.dll files, too.

For iOS with plugin version 7.3, you can just pass name of the dynapdf.framework or full file path. Please add the dynapdf.framework for the right platform (device vs. simulator) to your iOS SDK application and add it to the frameworks to link to in order to get it added to the app.

Starting version 9.5, the plugin will look into the same folder for the DLL as the plugin resides. And we still look for 32/64 suffixes to DLL name. If no name is provided, we look for dynapdf/dylib/so files.

If you get a crash here on macOS, please check if crash report says Code Signature Invalid. Then you may need to code sign the dylib yourself to match the code signature of your runtime application. The dylib from MBS is normally code signed already and should work as is.

  • If you get error 193 on Windows, you may have the wrong architecture. e.g. you got 32-bit, but you need 64-bit or vice versa.
  • If you got a dynapdf.dylib on macOS, that is no code signed, you will get back an error message, that the file is not allowed to load (disallowed by OS policy).
  • If you got a dynapdf.dylib on macOS, that is not notarized, you may see a gate keeper dialog telling you the library was not searched for malware and the file can't be loaded (disallowed by OS policy).
  • If you got a or dynapdf.dylib for the wrong CPU architecture, the function will return an error with e.g. saying you need x86, but have arm code or vice versa.
  • if you managed to load a dynapdf.dylib with a broken code signature, you may see a crash when the plugin calls _pdfNewPDF function reporting a broken code signature.
  • If the file path is wrong, the macOS and Linux plugins report an error message about that. On Windows you may just get error 126, which means "module not found".
  • If the file is shorted than expected on macOS, you get an error with a message like this: slice 1 extends beyond end of file.
  • If you overwrite the dynapdf.dylib file after loading it, you may get crashes with broken code signature, if old and new file are not identical.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.


Initialize when needed:

#Initialize DynaPDF
If [MBS( "DynaPDF.IsInitialized" ) ≠ 1]
    If [Get ( SystemPlatform ) = -3]
        # iOS
        Exit Script []
    Else If [Get ( SystemPlatform ) = -2]
        # Windows
        Set Variable [$path; Value: "dynapdf.dll"]
        # Mac
        Set Variable [$path; Value: "dynapdf.dylib"]
    End If
    Set Variable [$r; Value: MBS( "DynaPDF.Initialize"; $path; "12345..." )]
    If [$r ≠ "OK"]
        Show Custom Dialog [ "DynaPDF failed to initialize"; $r]
    End If
End If

Initialize with path for demo:

MBS( "DynaPDF.Initialize"; $path)

Initialize with path and serial for real usage:

MBS( "DynaPDF.Initialize"; $path; $serial)

Initialize on server with dynapdf.dylib in Server folder on Mac:

MBS( "DynaPDF.Initialize"; "/Library/FileMaker Server/dynapdf.dylib"; $serial)

Initialize on server with dynapdf.dylib in Server folder on Windows:

MBS( "DynaPDF.Initialize"; "C:\Programs\FileMaker Server\dynapdf.dll"; $serial)

Initialize with check for server:

If [MBS("IsServer")]
    # locate with absolute path
    Set Variable [$path; Value: "/Library/FileMaker Server/Database Server/Extensions/dynapdf.dylib"]
    # locate with name in extensions folder
    Set Variable [$path; Value: "dynapdf.dylib"]
End If

# initialize dynapdf
Set Variable [$r; Value: MBS( "DynaPDF.Initialize"; $path) ]

Write library to disk from container and initialize:

# your license key if you have one
Set Variable [$SerialNumber; Value:""]
# where we store the library file
Set Variable [$tempFolder; Value:MBS( "Folders.UserTemporary" )]
If [MBS( "IsMacOSX" )]
    # library for Mac from Container
    Set Variable [$container; Value:DynaPDF::DynaPDFLibMacContainer]
    Set Variable [$filename; Value:"dynapdf.dylib"]
Else If [MBS( "IsWindows" )]
    # library for Win from Container
    Set Variable [$container; Value:DynaPDF::DynaPDFLibWinContainer]
    Set Variable [$filename; Value:"dynapdf.dll"]
    Exit Script []
End If
Set Variable [$filepath; Value:MBS( "Path.AddPathComponent"; $tempFolder; $filename)]
# write file
Set Variable [$r; Value:MBS( "Files.WriteFile"; $container; $filepath)]
If [$r ≠ "OK"]
    Show Custom Dialog ["Writing file failed"; $r]
End If
# now initialize
Set Variable [$r; Value:MBS( "DynaPDF.Initialize"; $filepath; $SerialNumber)]
If [$r ≠ "OK"]
    Show Custom Dialog ["DynaPDF initialization failed"; $r]
End If

Register with Startup script for server and client:

Startup Script:

#Register for client
Perform Script [“InitMBS”]
#Register for server. Will be ignored if no server or no plugin installed on server
Perform Script on Server [“InitMBS”]

InitMBS script:

#Enable debug logging. Shows messages in DebugView/
Set Variable [$r; Value:MBS("Trace")]
#Register if needed for right platform
If [MBS("IsRegistered") = 0]
    If [MBS("IsRuntime")]
        Set Variable [$r; Value:MBS("Register"; "test"; "Complete"; "Runtime"; 123; 123)]
    Else If [MBS("IsServer")]
        Set Variable [$r; Value:MBS("Register"; "test"; "Complete"; "Server"; 123; 123)]
    Else If [MBS("IsClient")]
        Set Variable [$r; Value:MBS("Register"; "test"; "Complete"; "5 Seats"; 123; 123)]
        Set Variable [$r; Value:"Unknown platform: " & MBS("Platform")]
    End If
    #Show errors, so developer can fix them
    If [$r ≠ "OK"]
        Show Custom Dialog ["InitMBS failed."; $r]
    End If
End If
#May initialize other stuff
#like dynapdf with library in extensions folder
If [MBS("DynaPDF.IsInitialized") = 0]
    Set Variable [$DynaPDFLicense; Value:"1003637-16022016-3-8-12-685C57F..."]
    If [MBS("IsWindows")]
        Set Variable [$r; Value:MBS( "DynaPDF.Initialize"; "dynapdf.dll"; $DynaPDFLicense)]
    Else If [MBS("IsMacOSX")]
        Set Variable [$r; Value:MBS( "DynaPDF.Initialize"; "dynapdf.dylib"; $DynaPDFLicense)]
        Set Variable [$r; Value:"Unknown platform: " & MBS("Platform")]
    End If
    #Show errors, so developer can fix them
    If [$r ≠ "OK"]
        Show Custom Dialog ["InitMBS failed."; $r]
    End If
End If

Initialize on server with in Server folder on FileMaker Cloud (Linux):

MBS( "DynaPDF.Initialize"; "/opt/FileMaker/FileMaker Server/"; $serial)

Initialize in iOS:

MBS("DynaPDF.Initialize"; "DynaPDF.framework")
# framework or dylib in Frameworks folder inside app, name case sensitive!

Write DynaPDF library to same folder as plugin:

Goto Layout [ “MBS Update” (MBS Update) ; Animation: None ]
Go to Record/Query/Page [ First ]
Set Variable [ $folder ; Value: MBS( "Plugin.Path" ) ]
Set Variable [ $folder ; Value: MBS( "Path.RemoveLastPathComponent"; $folder ) ]
Set Variable [ $path ; Value: MBS( "Path.AddPathComponent"; $folder; "dynapdf.dylib" ) ]
Set Variable [ $Plat ; Value: MBS("Files.MoveToTrash"; $path) ]
Set Variable [ $Plat ; Value: MBS("Files.WriteFile"; MBS Update::dynaPdfMac; $path) ]

Initialize automatically and look in same folder as plugin for the DLL/dylib/so file:

MBS("DynaPDF.Initialize"; ""; $license)

See also

Release notes

  • Version 14.3
    • Added check to XL.Initialize and DynaPDF.Initialize to return an error if the license key includes invalid characters like a space character.
  • Version 13.3
    • Changed DynaPDF.Initialize to ignore calls with old license key, if a valid key was set before.
  • Version 13.0
    • Changed DynaPDF.Initialize function to return an error, if the license key contains invalid characters on the beginning.
  • Version 10.1
    • Changed DynaPDF.Initialize to accept Starter, Lite, Pro and Enterprise texts for demo modes again.
  • Version 9.5
    • Changed DLL loading for DynaPDF.Initialize and XL.Initialize functions to look for given DLL path, try 32/64 DLLs. If only file name is given, we look into plugin folder, too. If no file name is given, we try default file name.
  • Version 9.2
  • Version 8.5
  • Version 8.0

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 27th January 2024

DynaPDF.InitColorManagementEx - DynaPDF.InsertBarcode