CUPS.PrintDataEncoding
----------------------

Print a file to a printer or class on the default server.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CUPS](component_CUPS.md) | [6.3](newinversion63.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "CUPS.PrintDataEncoding"; Printer; Data; Encoding { ; Title; Options } ) 

**MBS**( **"CUPS.PrintDataEncoding";** /\* Print a file to a printer or class on the default server. \*/  
**$Printer**; /\* The name of the printer.  
Please use CUPS printer name with underscore instead of spaces.e.g. "Brother\_DCP\_8085DN" \*/   
**$Data**; /\* The file data to print. You can include escapes with backslash. \\n gives new line, \\r gives return, \\\\ gives a backslash. \\xx with a hex number gives that character. e.g. \\41 gives an A.e.g. "Hello World\\nJust a test!\\n" \*/   
**$Encoding**; /\* The text encoding for data.e.g. "UTF-8" \*/   
**$Title**; /\* Optional; The title of the print job.e.g. "FileMaker Printout" \*/   
**$Options**) /\* Optional; List of options. Simply add key and values as string parameters to the function call.e.g. "key1"; "value1"; "key2"; "value2" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Printer | The name of the printer.   Please use CUPS printer name with underscore instead of spaces. | "Brother\_DCP\_8085DN" |  |
| Data | The file data to print. You can include escapes with backslash. \\n gives new line, \\r gives return, \\\\ gives a backslash. \\xx with a hex number gives that character. e.g. \\41 gives an A. | "Hello World\\nJust a test!\\n" |  |
| Encoding | The text encoding for data.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "UTF-8" |  |
| Title | The title of the print job. | "FileMaker Printout" | Optional |
| Options | List of options. Simply add key and values as string parameters to the function call. | "key1"; "value1"; "key2"; "value2" | Optional |

### Result

Returns OK or error.

### Description

Print a file to a printer or class on the default server.  
With \\xx you can embed any character in the text.  
\\t gives a tab, \\n a LF, \\r a newline.  
### Examples

Sends some data in Windows encoding:

 Set Variable \[$data ; Value:"Hello World.¶Tägliche Grüße!"\]  
Set Variable \[$data ; Value:MBS ( "[Text.ReplaceNewLine](TextReplaceNewLine.md)"; $data ; 3 )\]  
Set Variable \[$r ; Value:MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; $data ; "/tmp/test.txt"; "Windows" )\]  
Set Variable \[$r ; Value:MBS ( "CUPS.PrintDataEncoding"; "Brother\_DCP\_8085DN"; $data ; "Windows"; "Test Print" )\]  
### See also

- [CUPS.PrintData](CUPSPrintData.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)
- [Text.WriteTextFile](TextWriteTextFile.md)

### Blog Entries

- [MBS FileMaker Plugin, version 6.3pr4](https://www.mbsplugins.de/archive/2016-06-24/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th June 2016 , last changed 2nd February 2021

  
[CUPS.PrintData](CUPSPrintData.md) - [CUPS.PrintFile](CUPSPrintFile.md)

[HTML Version](CUPSPrintDataEncoding.shtml)