CURL.GetResultAsPDF
-------------------

Returns the result of the transaction as PDF.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [4.0](newinversion40.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.GetResultAsPDF"; curl { ; FileName; DontRenderPreview } ) 

**MBS**( **"CURL.GetResultAsPDF";** /\* Returns the result of the transaction as PDF. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$FileName**; /\* Optional; The desired file name.e.g. test.png \*/   
**$DontRenderPreview**) /\* Optional; Pass 1 to not create a JPEG with preview of first page as part of the container.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| curl | The CURL session handle. | $curl |  |
| FileName | The desired file name. | test.png | Optional |
| DontRenderPreview | Pass 1 to not create a JPEG with preview of first page as part of the container. | 0 | Optional |

### Result

The result value which you can assign to a container field.

### Description

Returns the result of the transaction as PDF.  
Make sure the data is a PDF. The plugin does not verify whether result is a PDF file. But if it is one, it sets size properties and creates a preview JPEG so FileMaker can preview it (Preview is Mac only).   
For Windows you can generate preview with [DynaPDF.GeneratePreview](DynaPDFGeneratePreview.md) function.  
Version 5.2 and later can use the filename from URL if you don't provide one yourself.  
  
See also [CURL.GetResultAsContainer](CURLGetResultAsContainer.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

Load PDF from URL and store in container:

 # start new transfer   
Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
\# set URL   
Set Variable \[$r ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "https://www.monkeybreadsoftware.com/filemaker/files/Installation.pdf")\]  
\# run transfer   
Set Variable \[$ErrorCode ; Value:MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
\# get result as PDF and store in field:   
Set Variable \[$Result ; Value:MBS ( "CURL.GetResultAsPDF"; $curl )\]  
Set Field \[test::MyContainerField ; $Result \]  
\# get debug messages:   
Set Variable \[$DebugMessages ; Value:MBS ( "[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
\# cleanup   
Set Variable \[$r ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
### See also

- [CURL.GetResultAsContainer](CURLGetResultAsContainer.md)
- [CURL.GetResultAsData](CURLGetResultAsData.md)
- [CURL.GetResultAsGIF](CURLGetResultAsGIF.md)
- [CURL.GetResultAsJPEG](CURLGetResultAsJPEG.md)
- [CURL.GetResultAsMime](CURLGetResultAsMime.md)
- [CURL.GetResultAsText](CURLGetResultAsText.md)
- [CURL.New](CURLNew.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)

### Release notes

- **Version 15.1**
    - Improved [CURL.GetResultAsGIF](https://www.mbsplugins.eu/CURLGetResultAsGIF.shtml), [CURL.GetResultAsJPEG](https://www.mbsplugins.eu/CURLGetResultAsJPEG.shtml), [CURL.GetResultAsPDF](https://www.mbsplugins.eu/CURLGetResultAsPDF.shtml) and [CURL.GetResultAsPNG](https://www.mbsplugins.eu/CURLGetResultAsPNG.shtml) to return empty if the data is not the expected type.

### Example Databases

- [CURL/CURL Download PDF and add preview with DynaPDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Download%20PDF%20and%20add%20preview%20with%20DynaPDF.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 15.1pr1](https://www.mbsplugins.de/archive/2025-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)
- [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.0pr2](https://www.mbsplugins.de/archive/2014-01-08/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 19th April 2020

  
[CURL.GetResultAsMime](CURLGetResultAsMime.md) - [CURL.GetResultAsPNG](CURLGetResultAsPNG.md)

[HTML Version](CURLGetResultAsPDF.shtml)