LlSetPrinterInPrinterFile

Syntax:

INT LlSetPrinterInPrinterFile (HLLJOB hJob, UINT nObjType, LPCTSTR pszObjName, INT nPrinter, LPCTSTR pszPrinter, _PCDEVMODE pDM);

Task:

Replaces a printer in a printer configuration file by a new one or allows you to set special printer parameters

Parameter:

hJob: List & Label job handle

nObjType: LL_PROJECT_LABEL, LL_PROJECT_CARD or LL_PROJECT_LIST

pszObjName: Project name with file extension

nPrinter: Printer index (0: range with "Page() == 1" [will be created automatically if necessary], 1: default range, -1: creates only the default range and deletes other ranges that may exist).

If the project contains multiple layout regions you can use indices starting from 99, where 99 will set the printer for all regions, 100 for the first, 101 for the second and so on.

pszPrinter: Printer name

pDM: Address of new DEVMODE structure. If NULL, the default settings of the printer will be used.

Return Value:

Error value

Hints:

This function allows you to define the printer that will be used for printing. If the printer configuration file does not exist, it will be created. By "oring" the project type with LL_PRJTYPE_OPTION_FORCEDEFAULTSETTINGS you can force the printer's default settings for the print job.

As the printer configuration file will be used by LlPrint[WithBox]Start(), the function must be called before this function.

The DEVMODE structure is defined in the Windows API help file.

Due to the possibility to define layout regions in the Designer the practical benefit of this function has been quite limited. We recommend to use the LL object model according to chapter Using the DOM-API (Professional/Enter­prise Edition Only) to access the layout regions and the associated printers.

The default printer in the preview can be set with LL_OPTION_FORCE_DEFAULT_PRINTER_IN_PREVIEW.

These and related functions which affect the printer configuration file (the so-called "P-File") to change printer settings cannot be used when Printerless (see LL_OPTION_PRINTERLESS) is enabled.

Example:

HLLJOB   hJob;
hJob = LlJobOpen(0);
LlSetPrinterInPrinterFile(hJob, LL_PROJECT_LABEL, "test.lbl", -1,
   "Label Printer", NULL);
<... etc ...>
LlJobClose(hJob);

See also:

LlSetPrinterToDefault, LlPrintStart, LlPrintWithBoxStart, LlPrintCopyPrinter-Confi­guration, LlPrintSetPrinterDefaultsDir, GetPrinterFromPrinterFile