打印时用的打印机是:EPson Lq-300K+II
主要代码如下:
public string is_printerName = "Epson LQ-1600K";
CustomerPrinter lcp_printer = new CustomerPrinter();
lcp_printer.PrinterSettings.PrinterName = is_printerName;
                System.Drawing.Printing.PaperSize lps_paperSize = new System.Drawing.Printing.PaperSize();
                //System.Drawing.Printing.PaperSize lps_paperSize = new System.Drawing.Printing.PaperSize("ssss",270,300);
                System.Drawing.Printing.Margins lm_margin = new Margins(10, 10, 10, 10);
                decimal ldec_height = 80.0M, ldec_width = 20.5M;//(厘米)            
                lps_paperSize.Width = Convert.ToInt32(Decimal.Divide(ldec_width * 100, 2.54M));
                lps_paperSize.Height = Convert.ToInt32(Decimal.Divide(ldec_height * 100, 2.54M));
                lcp_printer.PrinterSettings.DefaultPageSettings.PaperSize = lps_paperSize;                lcp_printer.DefaultPageSettings.PaperSize = lps_paperSize;
                lcp_printer.DefaultPageSettings.Margins = lm_margin;
                lcp_printer.PrintPage += new PrintPageEventHandler(pd_PrintPage);
                lcp_printer.EndPrint += new PrintEventHandler(pd_EndPrint);
                lcp_printer.Print();
/// <summary>
        /// 文档对象开始打印页时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pd_PrintPage(object sender, PrintPageEventArgs e)
        {
            Color lc_color = new Color();
            lc_color = Color.Blue;
            //Pen lp_pen = new Pen(lc_color);
            //e.Graphics.DrawLine(lp_pen, 10, 10, 100, 10);
            e.Graphics.DrawString("this is 150*10.5(CM) Begin", new Font("Arial", 24), Brushes.Black, 10, 100);
            e.Graphics.DrawString("this is 150*10.5(CM) End", new Font("Arial", 24), Brushes.Black, 10, 3056);
            /*
            for (int i = 0; i < 3000; i++)
            {
                e.Graphics.DrawString("test:" + i.ToString(),new Font("Arial",10),Brushes.Black,10,10 + i*2);
            }//*/
            //          e.Graphics.DrawString("",new Font("Aria",12),
                    }        private void pd_EndPrint(object sender, PrintEventArgs e)
        {        }为什么在打印完80cm后,打印机还要多走一些纸?如何控制打印机在打印到80cm后就自动停在要打印的内容后面.