I've this piece of code, and i want to print files, how can i do it? Preview and Print???
I've been trying several things to preview and print and this is the closest i've got!!
private void Imprimir()
{
PrintDocument pd = new PrintDocument();
pd.DocumentName = "Certificado de Abate IMTT";
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
PrintDialog printdlg = new PrintDialog();
PrintPreviewDialog printPrvDlg = new PrintPreviewDialog();
// preview the assigned document or you can create a different previewButton for it
printPrvDlg.Document = pd;
printPrvDlg.ShowDialog(); // this shows the preview and then show the Printer Dlg below
printdlg.Document = pd;
if (printdlg.ShowDialog() == DialogResult.OK)
{
pd.Print();
}
else
{
return;
}
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
}
Aucun commentaire:
Enregistrer un commentaire