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


Opens a PDF for importing from a file.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 3.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.OpenPDFFromFile"; PDF; Path { ; PasswordType; Password } )   More


Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Path The path to use. Should contain a PDF file. $path
PasswordType The password type and flags.
Flag kann be 1 for owner password and 0 for open password. You can combine this with 2 to force repair.
0 Optional
Password The password to decrypt the file. $password Optional


Returns 0, file handle or error message.


Opens a PDF for importing from a file.
Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required.
If you have the PDF in a container, please use DynaPDF.OpenPDFFromContainer function instead.

Requires DynaPDF Lite license.

If the function succeeds the return value is zero or the file handle if the flag UseProxy is set (a value greater or equal zero). If the function fails the return value is an error message.

After opening the file, please use DynaPDF.ImportPDFFile or DynaPDF.ImportPDFPage to import one or more pages. Or just check metadata with e.g. DynaPDF.GetImportDocInfo and check page count and sizes with DynaPDF.GetImportPageBounds and DynaPDF.GetImportPageCount.

See also OpenPDFFromFile function in DynaPDF manual.


Import selected pages from one PDF and write into a new one:

# New PDF
Set Variable [$pdf; Value:MBS("DynaPDF.New")]

# Open existing PDF file (or use DynaPDF.OpenPDFFromContainer for container)
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromFile"; $pdf; $path )]

# Query page count
Set Variable [$pageCount; Value:MBS( "DynaPDF.GetImportPageCount"; $pdf )]

# Import the pages you need
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 2)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 3)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; $pagecount - 1)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; $pagecount - 2)]

# Set output to this file path
# MBS( "DynaPDF.OpenOutputFile"; $pdf; "/Users/cs/Desktop/output.pdf" )

# Write PDF
Set Variable [$r; Value:MBS("DynaPDF.Save"; $pdf)]

# release memory
Set Variable [$r1; Value:MBS("DynaPDF.Release"; $pdf)]

Import a single page:

Set Variable [$r; Value:MBS("DynaPDF.SetImportFlags"; $pdf; "ImportAll ImportAsPage")]
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromFile; $pdf; "C:\test.pdf")]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFPage"; $pdf; 1)]

Load PDF and extract text of page 2:

# initialize DynaPDF before running this:
Set Variable [$pdf; Value:MBS("DynaPDF.New")]
# load PDF from container
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromFile";$pdf; "/Users/cs/Desktop/test.pdf")]
# import all pages
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFFile";$pdf)]
# extra text of page 2
Set Field [Test::PageText; MBS("DynaPDF.ExtractPageText"; $pdf; 2)]
Set Variable [$r; Value:MBS("DynaPDF.Release"; $pdf)]

Read in a file, add text and write back:

# Start new PDF
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# import existing file
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromFile"; $pdf; "/Users/cs/Temp/Installation.pdf") ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
Set Variable [ $r ; Value: MBS("DynaPDF.CloseImportFile"; $pdf) ]
# now edit a page
Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; "Helvetica"; 0; 20) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 100; "Hello World") ]
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
# save back to same file
Set Variable [ $r ; Value: MBS("DynaPDF.OpenOutputFile"; $pdf; "/Users/cs/Temp/Installation.pdf") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Save"; $pdf) ]
# cleanup
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 6th June 2024

DynaPDF.OpenPDFFromContainer - DynaPDF.OpenTag