Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    Statistic    FMM    Blog  

RichText.WritePDF

Write the current rich text document to a PDF file.

Component Version macOS Windows Linux Server iOS SDK
RichText 5.1 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ❌ No
MBS( "RichText.WritePDF"; Path )   More

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 functions. See blog post here:
https://www.mbs-plugins.com/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"; MBS( "Folders.UserTemporary" ); "temp.pdf")]
Set Variable [$r; Value:MBS( "RichText.ReadContainer"; test::MyContainerDoc )]
Set Variable [$r; Value:MBS( "RichText.WritePDF"; $temppath )]
Set Variable [$r; Value:MBS( "RichText.Release" )]
Set Field [test::MyContainerPDF; MBS("Files.ReadFile"; $temppath; "PDF"; "test.pdf")]

See also

Blog Entries

Created 14th March 2015, last changed 5th August 2021


RichText.WriteFile - RichText.WriteRTF

Feedback: Report problem or ask question.