CUPS.PrintData
--------------

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

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

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

**MBS**( **"CUPS.PrintData";** /\* 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" \*/   
**$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" |  |
| 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 job number.

### 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

Print data:

 MBS ( "CUPS.PrintData"; "Brother\_DCP\_8085DN"; "Hello World\\nJust a test!\\n"; "FileMaker Printout" )  
Print data with options:

 MBS ( "CUPS.PrintData"; "Brother\_DCP\_8085DN"; "Hello World\\nJust a test!\\n"; "FileMaker Printout";   
// first option  
"Scaling"; "75";  
// second option  
"media"; "A4" )  
Build Data, send to printer and write a text file for debugging:

 Set Variable \[$data ; Value:"#!A1#DC REM Drucker wird aktiviert¶" &amp; "#IMSR103.87 /25.00 REM Etikettenmasse¶" &amp; "#PR5/5/ REM Druckgeschwindigkeit¶" &amp; "#HV70 REM Druckhitze¶" &amp; "#ER¶" &amp; "¶" &amp; "¶" &amp; "¶" &amp; "#T06.5 #J18.7 #YN101/1R/33///\\\\80#G¶" …\]  
Set Variable \[$data ; Value:MBS ( "[Text.ReplaceNewLine](TextReplaceNewLine.md)"; $data ; 3 )\]  
Set Variable \[$r ; Value:MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; $data ; "/tmp/test.txt"; "Dos" )\]  
Set Variable \[$r ; Value:MBS ( "CUPS.PrintData"; "LabelPrinter"; $data ; "Label" )\]  
### See also

- [CUPS.PrintDataEncoding](CUPSPrintDataEncoding.md)
- [CUPS.PrintFile](CUPSPrintFile.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)
- [Text.WriteTextFile](TextWriteTextFile.md)

### Example Databases

- [CUPS/Print Data](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CUPS/Print%20Data.shtml#1ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 2nd February 2021

  
[CUPS.LastErrorMessage](CUPSLastErrorMessage.md) - [CUPS.PrintDataEncoding](CUPSPrintDataEncoding.md)

[HTML Version](CUPSPrintData.shtml)