最近我在使用 C#.net 在 Windows 应用程序上的项目教育管理系统中工作,因为我使用打印文档控件来打印标记表布局并且效果很好.. 但我必须在 Asp.net 网站上转换它因此,任何打印标记表布局与打印文档质量相同的打印方法和标记表的内容都从数据库中获取。任何有助于在 C#、Java 脚本中打印的代码。由于标记表打印,任何与打印相关但打印质量的代码都是必需的
我已经编写了它的窗口应用程序相关代码但我想要基于 Web 的解决方案
private void printDocument2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(Pens.Black, rectangleShape1.Location.X, rectangleShape1.Location.Y, rectangleShape1.Width, rectangleShape1.Height);
//////////////////////////////
e.Graphics.DrawString(label24.Text, label24.Font, Brushes.DarkBlue, label24.Location.X, label24.Location.Y);
e.Graphics.DrawString(label25.Text, label25.Font, Brushes.DarkBlue, label25.Location.X, label25.Location.Y);
e.Graphics.DrawString(label26.Text, label26.Font, Brushes.Brown, label26.Location.X, label26.Location.Y);
e.Graphics.DrawString(label27.Text, label27.Font, Brushes.Black , label27.Location.X, label27.Location.Y);
e.Graphics.DrawString(label28.Text, label28.Font, Brushes.Black, label28.Location.X, label28.Location.Y);
e.Graphics.DrawString(label29.Text, label29.Font, Brushes.Black, label29.Location.X, label29.Location.Y);
e.Graphics.DrawString(label30.Text, label30.Font, Brushes.Black, label30.Location.X, label30.Location.Y);
e.Graphics.DrawString(label31.Text, label31.Font, Brushes.Black, label31.Location.X, label31.Location.Y);
////////////////////////////
e.Graphics.DrawString(txtRollno.Text, txtRollno.Font, Brushes.Black, txtRollno.Location.X, txtRollno.Location.Y);
e.Graphics.DrawString(txtName.Text, txtName.Font, Brushes.Black, txtName.Location.X, txtName.Location.Y);
e.Graphics.DrawString(txtfathernameid.Text, txtfathernameid.Font, Brushes.Black, txtfathernameid.Location.X, txtfathernameid.Location.Y);
e.Graphics.DrawString(txtAddress.Text, txtAddress.Font, Brushes.Black, txtAddress.Location.X, txtAddress.Location.Y);
e.Graphics.DrawString(txtContact.Text, txtContact.Font, Brushes.Black, txtContact.Location.X, txtContact.Location.Y);
////////////////
e.Graphics.DrawImage(pictureBox1.Image, pictureBox1.Location.X, pictureBox1.Location.Y, pictureBox1.Width, pictureBox1.Height);
}
private void btnPrintPreview2_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printDocument2;
printPreviewDialog1.Show Dialog();
}