Preview.LoadContainer
---------------------

Loads a PDF document from data in container.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Preview](component_Preview.md) | [13.3](newinversion133.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Preview.LoadContainer"; PreviewRef; ContainerValue ) 

**MBS**( **"Preview.LoadContainer"** /\* Loads a PDF document from data in container. \*/  
**$PreviewRef**; /\* The reference ID for this preview control. e.g. $ref \*/   
**$ContainerValue**) /\* The container value (variable or field) to read the PDF from. e.g. MyTable::MyPDFContainer \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PreviewRef | The reference ID for this preview control. | $ref |
| ContainerValue | The container value (variable or field) to read the PDF from. | MyTable::MyPDFContainer |

### Result

Returns OK or error.

### Description

Loads a PDF document from data in container.  
Depending on what the preview handler can do, we either pass PDF directly in memory or use a temporary file, which later gets deleted when closing.  
  
For MBS Plugin 16.1 on macOS this got optimized to also handle other file types better. You can preview Keynote, Numbers or Pages files now from a container as well as many other types.  
### Examples

Load preview:

 Set Variable \[ $r ; Value: MBS ( "Preview.LoadContainer"; $$preview ; PDF Viewer::PDF Container ) \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to load container" ; $r \]   
End If  
### See also

- [IsError](IsError.md)
- [Preview.CreateWithControl](PreviewCreateWithControl.md)
- [Preview.Unload](PreviewUnload.md)

### Release notes

- **Version 16.2**
    - Improved [Preview.LoadContainer](https://www.mbsplugins.eu/PreviewLoadContainer.shtml) function to better work with non PDF files.

### Example Databases

- [PDF Viewer](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/PDF%20Viewer.shtml#3ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.2pr1](https://www.mbsplugins.de/archive/2026-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 18 - Preview](https://www.mbsplugins.de/archive/2023-12-18/MBS_Plugin_Advent_calendar_18_/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 13.3](https://www.mbsplugins.de/archive/2023-07-25/New_in_MBS_FileMaker_Plugin_13/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 12nd June 2023 , last changed 23th March 2026

  
[Preview.List](PreviewList.md) - [Preview.LoadFile](PreviewLoadFile.md)

[HTML Version](PreviewLoadContainer.shtml)