Pergunta

I need to print 2 different copies of this receipt using the same printer, and with only one print dialogue. Right now, the first copy prints fine, but then the fax dialogue comes up for the second one, because that's my default printer.

How would I do both using one printer? Or is there a way to print to a non default printer without the print dialogue. In this case, the printer will never change.

Thanks!

PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.BuildCustomerReciept);
PrintDialog pdi = new PrintDialog();
pdi.Document = pd;

PrintDocument pdd = new PrintDocument();
pdd.PrintPage += new PrintPageEventHandler(this.BuildStoreReciept);
PrintDialog pddi = new PrintDialog();
pddi.Document = pdd;


if (pdi.ShowDialog() == DialogResult.OK)
{
    pd.Print();
    pdd.Print();
}
Foi útil?

Solução

Did you tried that?

...
PrintDocument pd = new PrintDocument(); 
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
// Specify the printer to use. You can check its name in control panel
pd.PrinterSettings.PrinterName = "NameofThePrinter";  
pd.Print();
...
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top