日期:2014-05-17  浏览次数:20420 次

有没有做过Reprot报表RDLC直接打印的兄弟,遇到点麻烦,进来看一下。。



        private void Print3()
        {
            const string printerName="GP-5890XIII";
            if (m_streams == null || m_streams.Count == 0)
                return;
            PrintDocument printDoc = new PrintDocument();
            printDoc.PrinterSettings.PrinterName = printerName;

            printDoc.DefaultPageSettings.Landscape = false;
           // printDoc.PrinterSettings.DefaultPageSettings.PaperSize = printDoc.PrinterSettings.PaperSizes[0];
            foreach (PaperSize ps in printDoc.PrinterSettings.PaperSizes)
            {
                string myTempID = ps.PaperName;
                if (myTempID == "Gprinter 58(48) x 299 mm")
                {
                    printDoc.PrinterSettings.DefaultPageSettings.PaperSize = ps;
                    printDoc.DefaultPageSettings.PaperSize = ps;
                }
            }
            if (!printDoc.PrinterSettings.IsValid)
            {
                string msg = string.Format("Can't find printer \"{0}\".", printerName);
               
                return;