0

我正在使用MICR打印字体创建支票。对于从 gridview 中选择的记录,我正在创建一个检查。示例代码如下

public void print()
{
    try
    {
        PrivateFontCollection PFC = new PrivateFontCollection();
        PFC.AddFontFile(Server.MapPath("ADVMICR.TTF"));
        FontFamily fm = new FontFamily(PFC.Families[0].Name, PFC);
        Font PrintFont = new Font(fm, 12);

        PrintDocument pd = new PrintDocument();
        pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
        //Specify the printer to use.  HP LaserJet P2035
        pd.PrinterSettings.PrinterName = "HP LaserJet P2035";
        pd.Print();
    }
    catch (Exception Ee)
    {

    }
}

public void pd_PrintPage(object sender, PrintPageEventArgs e)
{
       e.Graphics.DrawString("PAY TO THE ORDER OF", drFont, drawBrush, 15.0F, 120.0F);
        e.Graphics.DrawString(FirstName + "," + MiddleInitial + ":" + LastName, drnarrowFont1, drawBrush, 145.0F, 117.0F);
        e.Graphics.DrawString(CompanyName, drarialblackFont, drawBrush, 140.0F, 30.0F);
        e.Graphics.DrawString(Address1, drsmallFont, drawBrush, 140.0F, 45.0F);
        e.Graphics.DrawString(City + "," + StateName, drsmallFont, drawBrush, 140.0F, 55.0F);
        e.Graphics.DrawString(Country + "," + ZipCode, drsmallFont, drawBrush, 140.0F, 69.0F);
        e.Graphics.DrawString("DATE", drFont, drawBrush, 595.0F, 70.0F);
        e.Graphics.DrawString(strDateTime, drnarrowFont, drawBrush, 650.0F, 65.0F);
        e.Graphics.DrawString("MEMO", drFont, drawBrush, 15.0F, 262.0F);
        e.Graphics.DrawString(iCheckno.ToString().PadLeft(4, (char)48), drFont, drawBrush, 730.0F, 20.0F);
        e.Graphics.DrawString(strFractionCode1, drnarrowFont, drawBrush, 720.0F, 40.0F);
        e.Graphics.DrawString("DOLLARS", drFont, drawBrush, 700.0F, 170.0F);
}

我想按照这里的打印前预览

http://projects.erikzaadi.com/jQueryPlugins/jQuery.printElement/

如果从 gridview 中选择了两条记录,我想分页显示它们。有人能帮我吗。

4