Save Records as PDF
Saves records to a specified PDF file.
Options
-
Save to is where to save the PDF file:
-
File specifies a PDF file path. When selected, the Specify output file option becomes available.
-
Target specifies a container field or variable. When selected, the Target option becomes available.
-
Currently open PDF appends the records to a PDF file that was opened using the Open PDF script step or Create PDF script step. When you append records to an open PDF, the PDF Options dialog box settings in the Document and Initial View tabs are ignored. Settings in the Security tab will not be applied to the PDF file.
-
-
Specify options displays the "Save Records as PDF" Options dialog box. If you select Blank record from the Save list, the Appearance list is enabled. The Appearance list allows you to specify formatting options for fields.
If Save to is File or Target, select Options to display the PDF Options dialog box.
-
In the Document tab, you can specify descriptive information for the PDF file. For each of the options in the document tab, you can enter text directly, or click Specify to enter a field name or values from a calculation.
-
In the Security tab, you can assign passwords to the PDF file, as well as print and edit privileges. If print and edit privileges are allowed, you can specify if copying and screen reading software are permitted.
-
In the Initial View tab, you can define the initial view for the layout and magnification for the PDF file.
-
Additional options available when Save to is File:
-
Specify output file defines a list of one or more paths and filenames for the PDF file. The script step searches the list and saves to the first path it can successfully write to. Paths must use one of the
filepath prefixes. See Creating file paths.You can also select:
-
Automatically open file to have the output file open with the default application
-
Create email with file as attachment to display a new email message in the user's default email application, with the output file attached
If FileMaker Pro runs a script that does not specify an absolute path, and the database file containing the script is hosted, the path is assumed to be the current user's Documents folder.
-
-
Append to existing PDF appends the records being browsed, the current record, or a blank record after the last page of the specified PDF file. When you append records, the PDF Options dialog box settings in the Document and Initial View tabs are ignored. Settings in the Security tab will not be applied to the PDF file. If the PDF file is already protected by a password, the password in the Security tab must match that for the PDF file.
-
With dialog specifies whether to display dialog boxes when the script step is performed, if a file has already been specified.
-
Create folders specifies whether to create new folders that you specify in the output file path.
Additional options available when Save to is Target:
-
Target specifies the container field or variable that the PDF file is saved to.
Compatibility
| Product | Supported |
| FileMaker Pro | Yes |
| FileMaker Go | Partial |
| FileMaker WebDirect | Partial |
| FileMaker Server | Partial |
| FileMaker Cloud | Partial |
| FileMaker Data API | Yes |
| Custom Web Publishing | No |
Originated in version
8.0
Description
This script step generates a PDF file from database records using the current layout for formatting and presentation. You can save records from the current found set, a single record, or create a PDF file with only the layout structure and no record data (for example, as a blank form to be filled in).
You can save the generated PDF file to various destinations: directly to a file on disk, to a container field for database storage, to a variable for further processing, or append it to a PDF file that was previously opened using the Open PDF script step or Create PDF script step. This flexibility allows you to integrate PDF generation into complex workflows and automated document processing systems.
Notes
-
This script step requires that your privilege set includes the Allow printing privilege, or that the script is set to run with full access privileges. See Editing other privileges and Creating and editing scripts.
-
This script step operates in all modes except Find mode.
-
In FileMaker Go:
-
The Create folders option is not supported.
-
Options in the Initial View tab are not supported.
-
If you don't specify the output file path, FileMaker Go uses the name of the window to save the PDF file.
-
When using the Append to existing PDF option:
-
Options set in the Document tab aren't ignored but won't overwrite fields with existing data
-
Only paths in the Documents and temporary folders are supported
-
-
-
In FileMaker Server and FileMaker Cloud:
-
The With dialog: On option is not supported.
-
Server-side scripts can access only certain folders. See Paths in server-side scripts.
-
-
In FileMaker WebDirect:
-
This script step is not supported on mobile devices.
-
Saved files download to the web browser's default download location.
-
The Create folders option is not supported.
-
-
In FileMaker Server, FileMaker Cloud, and FileMaker WebDirect:
-
The Automatically open file and Create email with file as attachment options are not supported.
-
The Print Setup script step sets options for this script step.
-
If fonts don't display correctly in the PDF file, make sure that all required fonts are installed and available to the Web Publishing Engine in your FileMaker Server deployment. See FileMaker Server Help. For a list of installed fonts for FileMaker Cloud, see FileMaker Cloud Help.
-
The Append to existing PDF option is supported only when appending to PDF files that were previously created within the same script.
-
If this script step performs multiple times in the same script and doesn't use Append to existing PDF, make sure each instance of this script step uses a unique filename. Otherwise, the most recently created PDF file will overwrite older files with the same name.
-
If a file path is not specified, the default filename is "Untitled.pdf".
-
Web viewers don't display content in PDF files.
-
Example 1 - Save current records to new PDF file
Goes to the Products layout, shows all records, sorts the records, and saves the records as a PDF without prompting the user.
Go to Layout [ "Products" (Products) ; Animation: None ]
Show All Records
Sort Records [ Restore ; With dialog: Off ]
Save Records as PDF [ Restore ; Save to: File ; "Product Catalog.pdf"; Create folders: Off ; With dialog: Off; Records being browsed ]
Example 2 - Save records to new PDF file then append related records
Finds all invoices with the current record's Customer ID, sorts, saves the invoices to a PDF, and appends the products purchased by the customer to the PDF.
Go to Layout [ "Invoices" (Invoices) ; Animation: None ]
Find Matching Records [ Replace ; Invoices::Customer ID ]
Sort Records [ Restore ; With dialog: Off ]
Save Records as PDF [ Restore ; Save to: File ; "Customer Backup.pdf" ; Create folders: Off ; With dialog: Off ; Records being browsed ]
Go to Related Record [ Show only related records ; Match found set ; From table: "Products" ; Using layout: "Products" (Products) ]
Save Records as PDF [ Restore ; Save to: File ; Append ; "Customer Backup.pdf" ; Create folders: Off ; With dialog: Off ; Records being browsed ]
Go to Layout [ original layout ; Animation: None ]
Example 3 - Create a PDF report and add multiple sections
Creates a comprehensive report by building a PDF in memory, adding multiple sections from different layouts, then saving the complete document to a file path.
Create PDF [ ]
Append PDF [ Source: File ; "CoverPage.pdf" ]
Go to Layout [ "Executive Summary" (Reports) ; Animation: None ]
Save Records as PDF [ Restore ; Save to: Currently open PDF ; Current record ]
Go to Layout [ "Sales Report" (Sales) ; Animation: None ]
Save Records as PDF [ Restore ; Save to: Currently open PDF ; Records being browsed ]
Append PDF [ From: Source ; Global::StandardAppendix ]
Set Variable [ $filePath ; Value:
Get ( DocumentsPath ) & "Annual_Report_" &
Year ( Get ( CurrentDate ) ) & ".pdf"
]
Close PDF [ Save to: File ; $filePath ; Create folders: On ]