private void button1_Click(object sender, EventArgs e) { PrintJob.PrintJob printJob = new PrintJob.PrintJob(txtPaperDef.Text, txtLabelDef.Text + @"\"); try{ printJob.Parse(txtBaseFolder.Text + @"\" + txtFilename.Text); PrintEngine pi = new PrintEngine("pc-mve2"); pi.DesignMode = false; pi.AddPrintJob(printJob); pi.Print("doc", cmbPrinters.Text, cmbTray.Text, cmbPaper.Text, 0, int.MaxValue, 1043); } catch { MessageBox.Show("Error trying to print.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonPrintPreview_Click(object sender, EventArgs e) { PrintJob.PrintJob printJob = new PrintJob.PrintJob(txtPaperDef.Text, txtLabelDef.Text + @"\"); try { printJob.Parse(txtBaseFolder.Text + @"\" + txtFilename.Text); PrintEngine printEngine = new PrintEngine("pc-psmo"); printEngine.DesignMode = chkDebugMode.Checked; printEngine.AddPrintJob(printJob); printEngine.PrintPreview(cmbPrinters.Text, cmbPaper.Text, cmbTray.Text, chkDebugMode.Checked, 0, uint.MaxValue); } catch { MessageBox.Show("Error trying to show print preview.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }