Printer.Print
-------------

Prints a document with options.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Printer](component_Printer.md) | [6.5](newinversion65.md) | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Printer.Print"; Printer { ; CloseDialog; Number of Copies; Paper Format; Paper Orientation; Paper Source; Pages From; Pages To; Collate Pages; What; PrintToFile } ) 

**MBS**( **"Printer.Print";** /\* Prints a document with options. \*/  
**$Printer**; /\* The printer name to set.  
Must not match exactly, just the first letters.  
If empty, we use current.e.g. "Brother" \*/   
**$CloseDialog**; /\* Optional; Whether to close print dialog.  
Pass 0 to leave dialog open.  
Pass 1 to close by pressing OK.  
Pass 2 to press cancel button in case you just want to learn the options.  
Pass 3 to leave dialog open, but close sub dialog.e.g. 1 \*/   
**$Number of Copies**; /\* Optional; The number of copies.  
Leave empty to not change.e.g. 1 \*/   
**$Paper Format**; /\* Optional; The name of the paper format.  
Leave empty to not change.e.g. "A4" \*/   
**$Paper Orientation**; /\* Optional; The paper orientation.  
Pass portrait or landscape. Empty value leaves setting as is.e.g. "landscape" \*/   
**$Paper Source**; /\* Optional; The paper source.  
Pass name of setting. Name doesn't need to match exactly, just first letters.   
So you can pass "Man" für Manual (English) and Manuell (German).e.g. "Man" \*/   
**$Pages From**; /\* Optional; The start number of page range.  
Pass empty text for Pages From and To to select all pages.e.g. 1 \*/   
**$Pages To**; /\* Optional; The end number of page range.  
Pass empty text for Pages From and To to select all pages.e.g. 1 \*/   
**$Collate Pages**; /\* Optional; Whether to collate pages.  
Pass 1 to enable or 0 to disable.  
Other values are ignored, so pass -1 or empty value to leave existing value.e.g. 1 \*/   
**$What**; /\* Optional; What to print:   
Pass 0 for records being browsed.  
Pass 1 for current record.  
Pass 2 for Blank Record showing fields.  
Default is empty (or -1) to keep current setting.e.g. 0 \*/   
**$PrintToFile**) /\* Optional; Whether to print to file.  
Pass 1 to enable or 0 to disable.  
Other values are ignored, so pass -1 or empty value to leave existing value. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Printer | The printer name to set.   Must not match exactly, just the first letters.   If empty, we use current. | "Brother" |  |
| CloseDialog | Whether to close print dialog.   Pass 0 to leave dialog open.   Pass 1 to close by pressing OK.   Pass 2 to press cancel button in case you just want to learn the options.   Pass 3 to leave dialog open, but close sub dialog. | 1 | Optional |
| Number of Copies | The number of copies.   Leave empty to not change. | 1 | Optional |
| Paper Format | The name of the paper format.   Leave empty to not change. | "A4" | Optional |
| Paper Orientation | The paper orientation.   Pass portrait or landscape. Empty value leaves setting as is. | "landscape" | Optional |
| Paper Source | The paper source.   Pass name of setting. Name doesn't need to match exactly, just first letters.    So you can pass "Man" für Manual (English) and Manuell (German). | "Man" | Optional |
| Pages From | The start number of page range.   Pass empty text for Pages From and To to select all pages. | 1 | Optional |
| Pages To | The end number of page range.   Pass empty text for Pages From and To to select all pages. | 1 | Optional |
| Collate Pages | Whether to collate pages.   Pass 1 to enable or 0 to disable.   Other values are ignored, so pass -1 or empty value to leave existing value. | 1 | Optional |
| What | What to print:    Pass 0 for records being browsed.   Pass 1 for current record.   Pass 2 for Blank Record showing fields.   Default is empty (or -1) to keep current setting. | 0 | Optional |
| PrintToFile | Whether to print to file.   Pass 1 to enable or 0 to disable.   Other values are ignored, so pass -1 or empty value to leave existing value. |  | Optional      Added in version **12.1**. |

### Result

Returns OK or error.

### Description

Prints a document with options.  
The plugin will show the print dialog from FileMaker, automatically set options and close dialog if requested. Sub dialog for paper is opened if paper format, paper orientation or source is passed.  
The function returns before the dialog shows, so please do a script pause after calling this.  
  
This function requires the permissions for current user to print and the print menu commands be available via menu as we trigger those to print.  
  
You can later call Print.[ErrorLog](ErrorLog.md) to detect errors. If Windows ever change dialogs, features may no longer work. FileMaker may not show the print dialog if there is no record available or when debugger is open.  
  
For Mac, please check [PrintDialog.Install](PrintDialogInstall.md) function.  
To print on a server, you can create a PDF document and send it to printer via [DynaPDF.Print](DynaPDFPrint.md) or [PDFKit.Print](PDFKitPrint.md) functions.  
  
After calling this method, you can call [Printer.PaperFormats](PrinterPaperFormats.md), [Printer.PaperSources](PrinterPaperSources.md) or [Printer.PrinterNames](PrinterPrinterNames.md) to learn what was available.  
  
Version 9.1 or newer allows you to pass 3 for CloseDialog parameter to leave dialog open while sub dialog is closed.  
  
Original source code sponsored by schubec.com  
<http://www.schubec.com>  
### Examples

Print:

 Set Variable \[$r ; Value:MBS ("Printer.Print"; Printer Dialog::Printer Name; Printer Dialog::Close Dialog; Printer Dialog::Number of Copies; Printer Dialog::Paper Format; Printer Dialog::Paper Orientation; Printer Dialog::Paper Source; Printer Dialog:…\]  
Pause/Resume Script \[Duration (seconds): 2\]  
Show Custom Dialog \["Result"; MBS ("Printer.[ErrorLog](ErrorLog.md)")\]  
Install special print menu with print command:

 # set a menu with print commands, so the print works   
Install Menu Set \[ “\[Print\]” ; Use as file default: Off \]  
\# now let the plugin print   
Set Variable \[ $r ; Value: MBS ("printer.print") \]   
\# wait   
Pause/Resume Script \[Duration (seconds): 2\]  
\# and restore custom menus   
Install Menu Set \[ “\[Standard Menu\]” ; Use as file default: On \]  
### See also

- [PageSetupDialog.Install](PageSetupDialogInstall.md)
- [PrintDialog.Install](PrintDialogInstall.md)
- [Printer.CurrentNumberOfCopies](PrinterCurrentNumberOfCopies.md)
- [Printer.CurrentPaperFormat](PrinterCurrentPaperFormat.md)
- [Printer.CurrentPaperSource](PrinterCurrentPaperSource.md)
- [Printer.CurrentPrintWhat](PrinterCurrentPrintWhat.md)
- [Printer.ErrorLog](PrinterErrorLog.md)
- [Printer.PrinterInfo](PrinterPrinterInfo.md)
- [Printer.PrinterNames](PrinterPrinterNames.md)
- [Printer.SetDefaultPrinter](PrinterSetDefaultPrinter.md)

### Release notes

- **Version 16.4**
    - Improved [Printer.Print](https://www.mbsplugins.eu/PrinterPrint.shtml) function to wait for printer list to load for up to 5 seconds in case you have slow loading printer list.
- **Version 16.1**
    - Improved [Printer.Print](https://www.mbsplugins.eu/PrinterPrint.shtml) function to wait a bit if the combobox is not yet loaded on Windows.
- **Version 14.0**
    - Fixed [window](https://www.mbsplugins.eu/component_Window.shtml) functions for future FileMaker version, e.g. affect [Printer.Print](https://www.mbsplugins.eu/PrinterPrint.shtml).
- **Version 12.1**
    - Added PrintToFile parameter to [Printer.Print](https://www.mbsplugins.eu/PrinterPrint.shtml) function.
- **Version 10.2**
    - Fixed bug with [Printer.PrinterInfo](https://www.mbsplugins.eu/PrinterPrinterInfo.shtml) function returning value for NSDeviceIsPrinter parameter.
- **Version 9.2**
    - Added 20ms pause after setting copies in [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) to let dialog notice the change.
    - Changed [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) to only set collatePages is 0 or 1 and ignore parameter otherwise.
- **Version 9.1**
    - Added CloseDialog = 3 mode for [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) to keep main dialog open, but close sub dialog.
    - Fixed problem with [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) picking items in popup menu if you have two similar starting entries.
- **Version 9.0**
    - Changed [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) to prefer selecting exact match over beginning of text.
    - Improved out of bounds error message for [Menu.InsertItem](http://www.mbsplugins.eu/MenuInsertItem.shtml), [Menu.RemoveItemAtIndex](http://www.mbsplugins.eu/MenuRemoveItemAtIndex.shtml), [Calendar.Item.GetAttendeeURL](http://www.mbsplugins.eu/CalendarItemGetAttendeeURL.shtml), [Calendar.Item.GetAttendeeCommonName](http://www.mbsplugins.eu/CalendarItemGetAttendeeCommonName.shtml), [Calendar.Item.GetAttendeeStatus](http://www.mbsplugins.eu/CalendarItemGetAttendeeStatus.shtml), [Printer.PrinterName](http://www.mbsplugins.eu/PrinterPrinterName.shtml) and [CLGeocoder.PlacemarkValue](http://www.mbsplugins.eu/CLGeocoderPlacemarkValue.shtml).
- **Version 7.1**
    - Changed [Printer.Print](http://www.mbsplugins.eu/PrinterPrint.shtml) to make printer name optional.

### Example Databases

- [Win Only/Printer Switch/Printer Dialog](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Printer%20Switch/Printer%20Dialog.shtml#2ScriptAnchor_)
- [Win Only/Printer Switch/PrinterToolWin/printerTool\_FM15](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Printer%20Switch/PrinterToolWin/printerTool_FM15.shtml#1ScriptAnchor_)
- [Win Only/Printer Switch/Query Paper Formats and Sources](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Printer%20Switch/Query%20Paper%20Formats%20and%20Sources.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.4pr4](https://www.mbsplugins.de/archive/2026-09-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.1pr1](https://www.mbsplugins.de/archive/2026-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 23 - Printing a PDF](https://www.mbsplugins.de/archive/2024-12-23/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV - Printing in FileMaker with the MonkeyBread Plug-in](https://www.mbsplugins.de/archive/2024-04-17/MBS_@_FMTrainingTV_-_Printing_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.6pr3](https://www.mbsplugins.de/archive/2023-12-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Control printing in FileMaker with MBS Plugin on Windows](https://www.mbsplugins.de/archive/2023-06-12/Control_printing_in_FileMaker_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.1pr4](https://www.mbsplugins.de/archive/2022-02-22/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.2pr1](https://www.mbsplugins.de/archive/2019-04-02/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.1pr5](https://www.mbsplugins.de/archive/2019-03-01/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [Printer Switch for Windows with MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2016-11-14/Printer_Switch_for_Windows_wit/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2017, Seite 21 bis 23](https://filemaker-magazin.de/neuigkeit/3961-Appetithappen-FMM_201705)

This function is free to use.

Created 14th November 2016 , last changed 25th February 2026

  
[Printer.PaperSources](PrinterPaperSources.md) - [Printer.PrinterCount](PrinterPrinterCount.md)

[HTML Version](PrinterPrint.shtml)