Container.DecodeFromBase64
--------------------------

Decodes data from base64 text into a container value.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Container](component_Container.md) | [4.4](newinversion44.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Container.DecodeFromBase64"; Type; Text { ; FileName; DontRenderPreview } ) 

**MBS**( **"Container.DecodeFromBase64";** /\* Decodes data from base64 text into a container value. \*/  
**$Type**; /\* The type to return.   
Can be JPEG, TIFF, GIF, PNG, PDF or File.e.g. "JPEG" \*/   
**$Text**; /\* The text to process. \*/   
**$FileName**; /\* Optional; If type is container, this defines the file name to use.e.g. "test.txt" \*/   
**$DontRenderPreview**) /\* Optional; Pass 1 to not create a JPEG with preview of first page as part of the container. (only for returning PDF)e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Type | The type to return.    Can be JPEG, TIFF, GIF, PNG, PDF or File. | "JPEG" |  |
| Text | The text to process. |  |  |
| FileName | If type is container, this defines the file name to use. | "test.txt" | Optional |
| DontRenderPreview | Pass 1 to not create a JPEG with preview of first page as part of the container. (only for returning PDF) | 0 | Optional |

### Result

Returns container or error.

### Description

Decodes data from base64 text into a container value.  
See also [Container.GetBase64](ContainerGetBase64.md).  
  
If you have a DynaPDF Pro license and [DynaPDF](component_DynaPDF.md) functions initialized, this function can add previews for the PDF file on Windows and Linux. For MacOS, we make them with PDFKit.  
### Examples

From PDF in Base64 to a PNG in Base64:

 # decode some PDF in base64 text   
Set Variable \[$PDFData ; Value:MBS ( "Container.DecodeFromBase64"; "PDF"; PDF\_ToPNG::base64\_PDF ; "test.pdf" )\]  
\# render first page to a picture in PNG format   
Set Variable \[$PNGData ; Value:MBS ( "[PDFKit.GetPDFPageImage](PDFKitGetPDFPageImage.md)"; $PDFData ; 0; "PNG"; "test.png"; 150; 1; 0)\]  
\# encode PNG as Base64   
Set Variable \[$EncodedPNG ; Value:MBS ( "[Container.GetBase64](ContainerGetBase64.md)"; $PNGData ; "PNGf" )\]  
\# store text in a field   
Set Field \[PDF\_ToPNG::Convert\_text ; $EncodedPNG \]  
### See also

- [Container.DecodeFromHex](ContainerDecodeFromHex.md)
- [Container.GetBase64](ContainerGetBase64.md)
- [PDFKit.GetPDFPageImage](PDFKitGetPDFPageImage.md)

### Example Databases

- [DynaPDF/List XFA Fields](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/List%20XFA%20Fields.shtml#4ScriptAnchor_)
- [SmartCard/Belgian EID Reader](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SmartCard/Belgian%20EID%20Reader.shtml#3ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 5.1pr1](https://www.mbsplugins.de/archive/2015-03-16/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.4pr10](https://www.mbsplugins.de/archive/2014-11-08/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 6th November 2014 , last changed 13th October 2024

  
[Container.Compress](ContainerCompress.md) - [Container.DecodeFromHex](ContainerDecodeFromHex.md)

[HTML Version](ContainerDecodeFromBase64.shtml)