Valid from List & Label 15
You can use List & Label's object model (DOM) to set the printer without using LlSetPrinterInPrinterFile. Following is a sample for C#:
// needs to be called within the DefinePrintOptions event
// create list project class
ProjectList proj = new ProjectList(LL);
// get the currently loaded project
proj.GetFromParent();
// set the printer
proj.Regions[0].Device.Name = "\"<Printer name>\"";
If you want to save the options permanently, you’d need to open the project before calling LL.Print():
// set data source
LL.DataSource = ds;
// create list project class
ProjectList proj = new ProjectList(LL);
// open required project
proj.Open("test.lst", LlDomFileMode.OpenOrCreate, LlDomAccessMode.ReadWrite);
// set the printer
proj.Regions[0].Device.Name = "\"<Printer name>\"";
// save the project
proj.Save();
// close the project
proj.Close();
More hints on the usage of DOM functions can be found in the .NET component’s help file, the programmer’s reference and the diverse samples.
Related articles: