I'm working on a solution where I need to change the default printer for a label printer to print and go back to the previous default printer.
Would anyone have a solution for this?
I'm working on a solution where I need to change the default printer for a label printer to print and go back to the previous default printer.
Would anyone have a solution for this?
It worked fine, follow the code, thanks!
using System.Drawing.Printing;
using System.Runtime.InteropServices;
private void trocarImpressora()
{
ArrayList impressoras = new ArrayList();
int i = 0;
PrintDocument pd = new PrintDocument();
string impressoraPadraoOriginal = pd.PrinterSettings.PrinterName;
myPrinters.SetDefaultPrinter("ZDesigner GC420t (EPL)");
imprimir();
myPrinters.SetDefaultPrinter(impressoraPadraoOriginal);
}
public static class myPrinters
{
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetDefaultPrinter(string Name);
}