DynaPDF.Save
------------

Saves the current PDF to a container value which you can assign to a container field.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.0](newinversion30.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.Save"; PDF { ; FileName; Preview } ) 

**MBS**( **"DynaPDF.Save";** /\* Saves the current PDF to a container value which you can assign to a container field. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$FileName**; /\* Optional; Optionally the file name to be associated with the container value.  
The file name should include pdf file extension.e.g. "hello.pdf" \*/   
**$Preview**) /\* Optional; Optional, whether to include a preview JPEG. Default is 1 for including one. Pass zero to disable preview.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| FileName | Optionally the file name to be associated with the container value.   The file name should include pdf file extension. | "hello.pdf" | Optional |
| Preview | Optional, whether to include a preview JPEG. Default is 1 for including one. Pass zero to disable preview. | 1 | Optional |

### Result

Returns container value with PDF file.

### Description

Saves the current PDF to a container value which you can assign to a container field.  
The plugin also renders a JPEG for preview and includes it (with DynaPDF Pro).  
  
If you created PDF to a file path and not in memory, this method just returns OK after closing the file.  
Before you call this function, you can call [DynaPDF.OpenOutputFile](DynaPDFOpenOutputFile.md) or [DynaPDF.OpenOutputFileEncrypted](DynaPDFOpenOutputFileEncrypted.md) to open a destination file for the PDF.  
  
See [Plugin.SetPreviewSize](PluginSetPreviewSize.md) to control size of preview picture.  
  
If you have an open page, we close it automatically for you before doing the import.  
### Examples

Save PDF:

 Set Field \[ MyTable::ContainerField ; MBS ( "DynaPDF.Save"; $PDF ; "report.pdf" ) \]  
Save PDF without preview picture:

 Set Field \[ MyTable::ContainerField ; MBS ( "DynaPDF.Save"; $PDF ; "report.pdf"; 0 ) \]  
### See also

- [DynaPDF.Lab](DynaPDFLab.md)
- [DynaPDF.SetAlpha](DynaPDFSetAlpha.md)
- [DynaPDF.SetImportFlags](DynaPDFSetImportFlags.md)
- [DynaPDF.SetMetadata](DynaPDFSetMetadata.md)
- [DynaPDF.SkewCoords](DynaPDFSkewCoords.md)
- [DynaPDF.Table.Create](DynaPDFTableCreate.md)
- [DynaPDF.Table.Draw](DynaPDFTableDraw.md)
- [DynaPDF.WriteStyledText](DynaPDFWriteStyledText.md)
- [PKCS12.SignData](PKCS12SignData.md)
- [Plugin.SetPreviewSize](PluginSetPreviewSize.md)

### Release notes

- **Version 14.2**
    - Added CertificateName parameter to [DynaPDF.SaveAndSignFileWinCryptDialog](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileWinCryptDialog.shtml) function to skip dialog and pick certificate by name.
- **Version 13.4**
    - Added new parameter useDetached for [DynaPDF.SaveAndSignFileExt1](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt1.shtml) function.
- **Version 13.1**
    - Added [DynaPDF.SaveAndSignFileExt1](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt1.shtml) and [DynaPDF.SaveAndSignFileExt2](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt2.shtml) functions to sign a PDF using external PKCS7 signature provider.
- **Version 11.5**
    - Fixed documentation for [DynaPDF.SaveAndSignFileExt](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt.shtml) and added missing ContactInfo parameter.
- **Version 11.1**
    - Fixed bug in [DynaPDF.SaveAndSignFileExt](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt.shtml) function.
- **Version 11.0**
    - Added [DynaPDF.SaveAndSignFileExt](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileExt.shtml) function to sign PDF file with 2048 or 4096 bit key length.
- **Version 10.1**
    - Added [DynaPDF.SaveAndSignFileWinCrypt](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileWinCrypt.shtml) and [DynaPDF.SaveAndSignFileWinCryptDialog](https://www.mbsplugins.eu/DynaPDFSaveAndSignFileWinCryptDialog.shtml) functions.
- **Version 8.2**
    - Added checks to [DynaPDF.Optimize](http://www.mbsplugins.eu/DynaPDFOptimize.shtml), [DynaPDF.Print](http://www.mbsplugins.eu/DynaPDFPrint.shtml) and [DynaPDF.Save](http://www.mbsplugins.eu/DynaPDFSave.shtml) to complain if no pages are in document.

### Example Databases

- [Barcode/DynaPDF Barcode](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/DynaPDF%20Barcode.shtml#2ScriptAnchor_)
- [DynaPDF/Add Weblinks](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Add%20Weblinks.shtml#3ScriptAnchor_)
- [DynaPDF/Apply Letter Paper to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Apply%20Letter%20Paper%20to%20PDF.shtml#2ScriptAnchor_)
- [DynaPDF/Barcodes](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Barcodes.shtml#1ScriptAnchor_)
- [DynaPDF/Create PDF with Bezier Curves](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Create%20PDF%20with%20Bezier%20Curves.shtml#1ScriptAnchor_)
- [DynaPDF/DynaPDF Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/DynaPDF%20Test.shtml#10ScriptAnchor_)
- [DynaPDF/Page Layouting](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Page%20Layouting.shtml#2ScriptAnchor_)
- [DynaPDF/PDF Attachments](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20Attachments.shtml#6ScriptAnchor_)
- [DynaPDF/PDF Differences](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20Differences.shtml#1ScriptAnchor_)
- [DynaPDF/Signature Appearance](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Signature%20Appearance.shtml#3ScriptAnchor_)

### Blog Entries

- [Using DynaPDF with Data API for PDF generation](https://www.mbsplugins.de/archive/2026-05-25/Using_DynaPDF_with_Data_API_fo/monkeybreadsoftware_blog_filemaker)
- [Make PDF certificates in calculation with DynaPDF](https://www.mbsplugins.de/archive/2026-05-18/Make_PDF_certificates_in_calcu/monkeybreadsoftware_blog_filemaker)
- [Draw images with text using DynaPDF](https://www.mbsplugins.de/archive/2026-01-03/Draw_images_with_text_using_Dy/monkeybreadsoftware_blog_filemaker)
- [Retract text from a PDF with DynaPDF](https://www.mbsplugins.de/archive/2025-11-01/Retract_text_from_a_PDF_with_D/monkeybreadsoftware_blog_filemaker)
- [Use complex text rendering with DynaPDF in FileMaker](https://www.mbsplugins.de/archive/2025-06-25/Use_complex_text_rendering_wit/monkeybreadsoftware_blog_filemaker)
- [How the Script Merges PDFs and Inserts an Image: A Detailed Breakdown](https://www.mbsplugins.de/archive/2025-02-16/How_the_Script_Merges_PDFs_and/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 6 - Sending Out Wishlist Forms](https://www.mbsplugins.de/archive/2024-12-06/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 4 - Add GTC with DynaPDF](https://www.mbsplugins.de/archive/2024-12-04/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [DynaPDF Parser for FileMaker](https://www.mbsplugins.de/archive/2024-01-19/DynaPDF_Parser_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 15 - DynaPDF](https://www.mbsplugins.de/archive/2023-12-15/MBS_Plugin_Advent_calendar_15_/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2022, Seite 34](https://filemaker-magazin.de/neuigkeit/4191-Appetithappen-FMM_202204)
- [Ausgabe 6/2020, Seite 34](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)
- [Ausgabe 3/2019, Seite 39](https://filemaker-magazin.de/neuigkeit/4046-Appetithappen-FMM_201903)
- [Ausgabe 2/2019, Seite 26 bis 27](https://filemaker-magazin.de/neuigkeit/4043-Appetithappen-FMM_201902)
- [Ausgabe 5/2018, Seite 28](https://filemaker-magazin.de/neuigkeit/4011-Appetithappen-FMM_201805)
- [Ausgabe 1/2018, Seite 25](https://filemaker-magazin.de/neuigkeit/3981-Appetithappen-FMM_201801)

This function checks for a license.

Created 18th August 2014 , last changed 25th September 2024

  
[DynaPDF.RoundRectEx](DynaPDFRoundRectEx.md) - [DynaPDF.SaveAndSignFile](DynaPDFSaveAndSignFile.md)

[HTML Version](DynaPDFSave.shtml)