RichText.WritePDF
-----------------

Write the current rich text document to a PDF file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RichText](component_RichText.md) | [5.1](newinversion51.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "RichText.WritePDF"; Path ) 

**MBS**( **"RichText.WritePDF";** /\* Write the current rich text document to a PDF file. \*/  
**$Path**) /\* A valid native file path.e.g. "/Users/test/Desktop/test.pdf" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | A valid native file path. | "/Users/test/Desktop/test.pdf" |

### Result

Returns OK or error.

### Description

Write the current rich text document to a PDF file.  
  
Warning: The plugin can only read/write the styles/formats which Apple supports for their cocoa framework.  
  
While this function can be used to convert Microsoft Word documents to PDF, it is often better to script Libre Office with [Shell](component_Shell.md) functions. See blog post here:  
[https://www.mbsplugins.de/archive/2018-06-15/Convert\_office\_documents\_to\_PD/monkeybreadsoftware\_blog\_filemaker](https://www.mbsplugins.de/archive/2018-06-15/Convert_office_documents_to_PD/monkeybreadsoftware_blog_filemaker)  
### Examples

Convert doc/docx/rtf file in container to PDF:

 Set Variable \[$temppath ; Value:MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserTemporary](FoldersUserTemporary.md)" ); "temp.pdf")\]  
Set Variable \[$r ; Value:MBS ( "[RichText.ReadContainer](RichTextReadContainer.md)"; test::MyContainerDoc )\]  
Set Variable \[$r ; Value:MBS ( "RichText.WritePDF"; $temppath )\]  
Set Variable \[$r ; Value:MBS ( "[RichText.Release](RichTextRelease.md)" )\]  
Set Field \[test::MyContainerPDF ; MBS ("[Files.ReadFile](FilesReadFile.md)"; $temppath ; "PDF"; "test.pdf")\]  
### See also

- [Files.ReadFile](FilesReadFile.md)
- [Folders.UserTemporary](FoldersUserTemporary.md)
- [Path.AddPathComponent](PathAddPathComponent.md)
- [RichText.GeneratePDF](RichTextGeneratePDF.md)
- [RichText.ReadContainer](RichTextReadContainer.md)
- [RichText.Release](RichTextRelease.md)
- [RichText.WriteDOC](RichTextWriteDOC.md)
- [RichText.WriteFile](RichTextWriteFile.md)
- [RichText.WriteRTF](RichTextWriteRTF.md)

### Blog Entries

- [MBS FileMaker Plugin, version 5.1pr1](https://www.mbsplugins.de/archive/2015-03-16/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 14th March 2015 , last changed 25th January 2024

  
[RichText.WriteFile](RichTextWriteFile.md) - [RichText.WriteRTF](RichTextWriteRTF.md)

[HTML Version](RichTextWritePDF.shtml)