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

Preview.LoadFile

Loads a PDF document from file path.

Component Version macOS Windows Linux Server iOS SDK
Preview 13.3 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "Preview.LoadFile"; PreviewRef; Path )   More

Parameters

Parameter Description Example
PreviewRef The reference ID for this preview control. $ref
Path Native file path to the PDF file. "C:\test\test.pdf"

Result

Returns OK or error.

Description

Loads a PDF document from file path.
If the file path is invalid, the preview will show a file not found error message.

On macOS, this uses QuickLook preview, so you can show many common file types, including the following:

  • iWork documents
  • Microsoft Office documents
  • Rich text format, or RTF, documents
  • PDF files
  • Images
  • Text files with a uniform type identifier that conforms to the public.text type. To learn more, see Uniform type identifiers.
  • Comma-separated values, or CSV, files
  • 3D models in the USDZ format with both standalone and AR views for viewing the model

The list of supported common file types may change between operating system releases. In addition, you can enable previews for your own file types by implementing your own preview extension. Showing Word files may require to install Pages, Excel files require to install Numbers and Powerpoint files require to install Keynote application.

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.

Examples

Load file:

Set Variable [ $r ; Value: MBS( "Preview.LoadFile"; $$preview; PDF Viewer::PDF Path ) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Failed to load file" ; $r ]
End If

See also

Example Databases

Blog Entries

This function checks for a license.

Created 12nd June 2023, last changed 16th July 2023


Preview.LoadContainer - Preview.Release