Cancel PDF
Closes the open PDF in memory without saving it.
See also
Options
None.
Compatibility
| Product | Supported |
| FileMaker Pro | Yes |
| FileMaker Go | Yes |
| FileMaker WebDirect | Yes |
| FileMaker Server | Yes |
| FileMaker Cloud | Yes |
| FileMaker Data API | Yes |
| Custom Web Publishing | Yes |
Originated in version
26.0
Description
This script step closes the currently open PDF file in memory without saving it. Use this script step when you need to discard an in-progress PDF file, such as when:
-
An error occurs while using the Save Records as PDF or Append PDF script step and you need to discard the open PDF file
-
When your script gives the user the option to cancel PDF generation after a PDF file is opened
After this script step completes, no PDF file remains open, and you can create or open another PDF file if needed.
Notes
-
This script step discards the PDF file without saving it. To save the PDF file, use the Close PDF script step instead.
-
The open PDF file and any unsaved changes are lost if either of the following happens:
-
The current FileMaker client session ends
-
The FileMaker Pro file whose script opened the PDF file closes without closing the open PDF file
-
Example 1 - Cancel PDF on error
Creates a PDF report with error handling. If an error occurs while assembling the PDF file, the script closes the open PDF without saving it and notifies the user.
Set Error Capture [ On ]
Create PDF [ ]
If [ Get ( LastError ) ≠ 0 ]
Show Custom Dialog [ "Error" ; "Couldn't create PDF file." ]
Exit Script [ Text Result: "Failed" ]
End If
Append PDF [ From: File ; "CoverPage.pdf" ]
If [ Get ( LastError ) ≠ 0 ]
Cancel PDF
Show Custom Dialog [ "Error" ; "Couldn't add cover page to PDF file." ]
Exit Script [ Text Result: "Failed" ]
End If
Save Records as PDF [ Restore ; Save to: Currently open PDF ; Records being browsed ]
If [ Get ( LastError ) ≠ 0 ]
Cancel PDF
Show Custom Dialog [ "Error" ; "Couldn't add records to PDF file." ]
Exit Script [ Text Result: "Failed" ]
End If
Close PDF [ Save to: File ; "Report.pdf" ; Create folders: Off ]