Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  


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

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CUPS 2.5 Yes No Yes, macOS only No No
MBS( "CUPS.PrintData"; Printer; Data { ; Title; Options } )   More


Parameter Description Example value
Printer The name of the printer. "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 Optional
The title of the print job.
"FileMaker Printout"
Options Optional
List of options. Simply add key and values as string parameters to the function call.
"key1"; "value1"; "key2"; "value2"


Returns job number.


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.


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¶" & "#IMSR103.87/25.00 REM Etikettenmasse¶" & "#PR5/5/ REM Druckgeschwindigkeit¶" & "#HV70 REM Druckhitze¶" & "#ER¶" & "¶" & "¶" & "¶" & "#T06.5 #J18.7 #YN101/1R/33///\\80#G¶" …]
Set Variable [$data; Value:MBS( "Text.ReplaceNewline"; $data; 3 )]
Set Variable [$r; Value:MBS( "Text.WriteTextFile"; $data; "/tmp/test.txt"; "Dos" )]
Set Variable [$r; Value:MBS( "CUPS.PrintData"; "LabelPrinter"; $data; "Label" )]

See also

Example Databases

Created 18th August 2014, last changed 25th February 2017

CUPS.LastErrorMessage   -   CUPS.PrintDataEncoding

Feedback: Report problem or ask question.

MBS Xojo Plugins