Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.OpenOutputFile
The function opens the output file into which the PDF file should be written.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
Path | The file path to create the PDF. The file name should include pdf file extension. |
"C:\Test.pdf" |
Result
Returns OK on success.
Description
The function opens the output file into which the PDF file should be written.The PDF file must be created in memory if this function should be used. This is the case if you called DynaPDF.New without a file path.
It is strongly recommended to check with DynaPDF.HaveOpenDocument whether a PDF file is still in memory before calling this function.
If you get back an error "Cannot open file!", please check if you didn't open the file before with DynaPDF.OpenPDFFromFile. In that case a call to DynaPDF.CloseImportFile may be needed.
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.
See also OpenOutputFile function in DynaPDF manual.
Examples
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)]
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
- DynaPDF.FlushPages
- DynaPDF.HaveOpenDocument
- DynaPDF.ImportPDFFile
- DynaPDF.ImportPDFPage
- DynaPDF.New
- DynaPDF.OpenPDFFromContainer
- DynaPDF.OpenPDFFromFile
- DynaPDF.Release
- DynaPDF.SaveAndSignFileExt
- Path.FileMakerPathToNativePath
Example Databases
Blog Entries
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 6th June 2024