TFormer_SetPrinterName

Printing and Output · String encodings

Definition

Windows: ANSI

ERRCODE TFormer_SetPrinterName(HTFORM pInstance, LPCSTR pszPrinterName, DEVMODE * pDevMode);

Windows only: UTF-16

ERRCODE TFormer_SetPrinterNameW(HTFORM pInstance, LPCWSTR pszPrinterName, DEVMODE * pDevMode);

Unix: UTF-8

ERRCODE TFormer_SetPrinterName(HTFORM pInstance, LPCSTR pszPrinterName, LPCSTR pszCupsOptions);

Contract

Sets the name of the output device (file or printer).

You can assign one of the following values:

  • Printer name
    Any local or network printer name as defined on Windows or Linux/UNIX (CUPS).
    Use optional output-format prefixes to select a repository printer or to use direct PostScript printing, etc.

  • Output format prefix and file name
    Use an output-format prefix such as PDF: followed by the file path (see Printing and Export).
    A filename extension alone does not select an output format.

For file output, you can alternatively use TFormer_SetPrinterType with TFormer_SetOutputName. For Windows printer output, TFormer_SetOutputName can additionally specify the spool-job name; it does not select the printer.
An output-format prefix in TFormer_SetPrinterName implicitly selects the output type; a file-output prefix also sets the filename. See Printing and Export for how these settings interact.

On Windows platforms the parameter pDevMode may be used to modify default GDI printer settings. All valid fields passed via pDevMode are merged with the default settings of the printer question. For more information check out the Win32 SDK documentation.

Returns

ErrOk (0) in case of success, non-zero if an error occurred

Parameters

Parameter / typeDescription
pInstanceHTFORM

The TFORMer instance provided by a previous call to TFormer_Init

pszPrinterNameLPCSTR / LPCWSTR

Printer name as defined on Windows or in CUPS, or an output-format prefix followed by a destination (see Printing and Export). For standard printer output, use NULL or an empty string ("") to select the default printer.

pDevModeDEVMODE *

Optional device-mode settings for Windows printers, which can be used to modify the default GDI printer settings. All valid fields passed via pDevMode are merged with the default settings of the selected printer. For more information check out the Win32 SDK documentation. Use NULL for default settings.

pszCupsOptionsLPCSTR

Optional CUPS options string which is passed directly to CUPS (Linux/UNIX only). Use NULL for default settings.

Note

Call this function before generating output when selecting a printer or using an output-format prefix. It is not required for file output selected with TFormer_SetPrinterType and TFormer_SetOutputName.

Note

Usually this function is used instead of TFormer_SetPrinterType and TFormer_SetOutputName. If you print to a Windows printer you can use TFormer_SetOutputName to specify the name of the spool job.

Search documentation

Search in
More scopes
Additional scopes

All contents