# Printing

## <mark style="color:blue;">#print</mark>

This command set default printer and send additional variables to a printer

### Command Overview

<table data-full-width="true"><thead><tr><th width="136">Command<select><option value="69d37e59dbc44aaca6dc72161f84784b" label="#msg" color="blue"></option><option value="b928d283a7784fae8c94f7bc27467b23" label="#dlg" color="blue"></option><option value="dd3ea796575b44beb6fe421f4c920096" label="#goto" color="blue"></option><option value="2f5a685324fb43dcb163abd13cb8b03b" label="#print" color="blue"></option></select></th><th>Parameter</th></tr></thead><tbody><tr><td><span data-option="2f5a685324fb43dcb163abd13cb8b03b">#print</span></td><td>*def{:printer=[string]}{:?&#x3C;var0>=[string]:...:?&#x3C;varn>=[string]}</td></tr></tbody></table>

#### Parameter Description

<table data-full-width="true"><thead><tr><th width="162.33333333333331">Parameter</th><th width="115">Type</th><th>Options</th></tr></thead><tbody><tr><td>printer</td><td>[string]</td><td>Printer name to be used as default (e.g. "ZDesigner GX430t", the name in the Windows Printers control panel).</td></tr><tr><td>var</td><td>[string]</td><td>Variable(s) to be created/changed. Each variable name must start by '?', otherwise it is not recognized as variable. If variable does not exist, its created, otherwise the value of existing one is changed.</td></tr></tbody></table>

### Example

Set default printer and create/change two variables "header" and "footer".

<table data-full-width="true"><thead><tr><th width="161">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#print</td><td>*def:printer="ZDesigner GX430t":?header="Hello!":?footer="Good bye.."</td></tr></tbody></table>

## <mark style="color:blue;">Typical Use Cases for Printing</mark>

### <mark style="color:blue;">1. Label Printing</mark>

<figure><img src="/files/3QC7W8cgiQsSUshhp5R0" alt="" width="375"><figcaption></figcaption></figure>

Send an unformatted data to the specified printer (RAW printing). This allows typically to control label-printers by sending printer's command directly.&#x20;

Source data can be directly in test-file or in an external text-file. This depends on which of "sheet" or "file" argument of "label" command is used:&#x20;

• sheet used: range argument is required, data are in the specified sheet and range&#x20;

&#x20;• file used: data are in specified external text-file Variables (standard and test-file) are applied to final data before sending to the printer.

Variables (standard and test-file) are applied to final data before sending to the printer.

### Command Overview

<table data-full-width="true"><thead><tr><th width="136">Command<select><option value="69d37e59dbc44aaca6dc72161f84784b" label="#msg" color="blue"></option><option value="b928d283a7784fae8c94f7bc27467b23" label="#dlg" color="blue"></option><option value="dd3ea796575b44beb6fe421f4c920096" label="#goto" color="blue"></option><option value="2f5a685324fb43dcb163abd13cb8b03b" label="#print" color="blue"></option></select></th><th>Parameter</th></tr></thead><tbody><tr><td><span data-option="2f5a685324fb43dcb163abd13cb8b03b">#print</span></td><td>label:sheet=[string]:range=[string]{:printer=[string]}</td></tr></tbody></table>

#### Parameter Description

<table data-full-width="true"><thead><tr><th width="162.33333333333331">Parameter</th><th width="126">Type</th><th>Options</th></tr></thead><tbody><tr><td>sheet</td><td>[string]</td><td>Sheet name with print data</td></tr><tr><td>range</td><td>[string]</td><td><p>Range of specified sheet to obtain source data.</p><p><strong>Format</strong>: "&#x3C;cell-from>:&#x3C;cell-to>" (i.e. "A1:B10")<br>• one column only: all rows are merged to final printer's data (using "\n" separator, skipping empty rows)</p><p>• more than one colum:</p><p>-  first column is used like a row-filter:</p><p>"1" means data-row is always taken, empty means data-row is taken if non-empty, otherwise ignored</p><p>-  following columns are data: merged without any</p><p>separator from all cells of the row</p></td></tr><tr><td>printer</td><td>[string]</td><td><p>Optionally set a printer name. Required if no default printer set.</p><p> </p><p><strong>Default</strong>: printer set by *def</p></td></tr></tbody></table>

### Example

Following examples uses print commands of Zebra label printers.

Let's assume we have a sheet: "PRINT" with the following content

<figure><img src="/files/rbsvRkeClvwkaFPeyXRa" alt=""><figcaption><p>ZPL (Zebra Programming Language)</p></figcaption></figure>

<table data-full-width="true"><thead><tr><th width="161">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#print</td><td>label:sheet="PRINT":range="A1:A10"</td></tr></tbody></table>

**Result:** Print a simple one-text-only label using printer's data from sheet "PRINT", range A1 to A10 (one column, 10 cells in total) to the printer. Rows 7 to 10 are ignored, because they are empty. Rows 1 to 6 are merged into one string using LF ("\n") separator.

### <mark style="color:blue;">2. Print Simple Text</mark>

Send a plain text to the specified printer to print.

Usage is the same like Label printing, see for additional arguments only.

### Command Overview

<table data-full-width="true"><thead><tr><th width="136">Command<select><option value="69d37e59dbc44aaca6dc72161f84784b" label="#msg" color="blue"></option><option value="b928d283a7784fae8c94f7bc27467b23" label="#dlg" color="blue"></option><option value="dd3ea796575b44beb6fe421f4c920096" label="#goto" color="blue"></option><option value="2f5a685324fb43dcb163abd13cb8b03b" label="#print" color="blue"></option></select></th><th>Parameter</th></tr></thead><tbody><tr><td><span data-option="2f5a685324fb43dcb163abd13cb8b03b">#print</span></td><td>text:sheet=[string]:range=[string]{:printer=[string]}{:page-margin=[int]}</td></tr></tbody></table>

#### Additional Parameters (on top of ones included in label printing section)

<table data-full-width="true"><thead><tr><th width="162.33333333333331">Parameter</th><th width="82">Type</th><th>Options</th></tr></thead><tbody><tr><td>page-margin</td><td>[int]</td><td><p>Page margins in [mm].</p><p><strong>Default</strong>: 10 [mm]</p></td></tr></tbody></table>

### <mark style="color:blue;">3. Print Spreadsheet</mark>

Directly print the selected OpenOffice Calc's sheet. This is the same like "Print" functionality in the OpenOffice Calc

{% hint style="info" %}
**Requirements:**

It is necessary to define "Print sections" (the Format menu) in the test-file (.ods) - you have to remove them all on all sheets, or define a new on specified sheet to be printed otherwise nothing will happen after printing (no pages will be send to the printer)
{% endhint %}

### Command Overview

<table data-full-width="true"><thead><tr><th width="136">Command<select><option value="69d37e59dbc44aaca6dc72161f84784b" label="#msg" color="blue"></option><option value="b928d283a7784fae8c94f7bc27467b23" label="#dlg" color="blue"></option><option value="dd3ea796575b44beb6fe421f4c920096" label="#goto" color="blue"></option><option value="2f5a685324fb43dcb163abd13cb8b03b" label="#print" color="blue"></option></select></th><th>Parameter</th></tr></thead><tbody><tr><td><span data-option="2f5a685324fb43dcb163abd13cb8b03b">#print</span></td><td>sheet:{:printer=[string]}{:format=[enum]}{:orientation=[enum]}</td></tr></tbody></table>

#### Additional Parameter (on top of ones included in label printing section)

<table data-full-width="true"><thead><tr><th width="162.33333333333331">Parameter</th><th width="96">Type</th><th>Options</th></tr></thead><tbody><tr><td>sheet</td><td>[string]</td><td>Spreadsheet name to print.</td></tr><tr><td>format</td><td>[enum]</td><td><p>Paper format</p><p><strong>Default</strong>: A4</p></td></tr><tr><td>orientation</td><td>[enum]</td><td><p>Paper orientation: portrait or landscape</p><p> </p><p><strong>Default</strong>: portrait</p></td></tr></tbody></table>

### Example

Print the sheet "PRINT" on "PDFCreator" printer using standard A4 format - portrait.

<table data-full-width="true"><thead><tr><th width="161">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#print</td><td>sheet:"PRINT":printer="PDFCreator"</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://funtest-1.gitbook.io/funtest-documentation/creating-test-sequence/funtest-commands/printing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
