CSReportDll.cPrinter.starDoc C# (CSharp) Метод

starDoc() публичный Метод

public starDoc ( PrintDocument printDoc, String title, csReportPaperType paperSize, int orientation ) : bool
printDoc PrintDocument
title String
paperSize csReportPaperType
orientation int
Результат bool
        public bool starDoc(PrintDocument printDoc, String title, csReportPaperType paperSize, int orientation)
        {
            printDoc.DefaultPageSettings.Landscape = (orientation == (int)csRptPageOrientation.LANDSCAPE);
            printDoc.DefaultPageSettings.PaperSize = getPaperSize(paperSize);

            return true;
        }
    }

Usage Example

Пример #1
0
        private bool printPagesToPrinter(cPrinter printer, cIPrintClient objClient)
        {
            try
            {
                PrintDocument printDoc = new PrintDocument();

                cReportPaperInfo w_paperInfo = m_report.getPaperInfo();
                if (!printer.starDoc(printDoc,
                                        m_report.getName(),
                                        w_paperInfo.getPaperSize(),
                                        w_paperInfo.getOrientation()))
                {
                    return false;
                }

                printDoc.PrintPage += new PrintPageEventHandler(printPage);
                printDoc.PrinterSettings.PrinterName = printer.getDeviceName();

                //PrintDialog printDialog = new PrintDialog();
                //printDialog.Document = printDoc;

                //DialogResult dialogResult = printDialog.ShowDialog();
                //if (dialogResult == DialogResult.OK)
                //{
                    m_pageToPrint = -1;
                    m_pagesToPrint = pGetPagesToPrint(printer.getPaperInfo().getPagesToPrint());
                    m_objClientToPrint = objClient;
                    printDoc.Print();
                //}

                /*
                for (i = 0; i < m_report.getPages().count(); i++)
                {
                    if (pHaveToPrintThisPage(i, vPages))
                    {
                        if (!printer.starPage())
                        {
                            throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING,
                                                      C_MODULE,
                                                      "Ocurrio un error al imprimir el reporte."
                                                      );
                        }
                        printPage(i, true);

                        if (!drawPage(printer))
                        {
                            return false;
                        }
                        if (!printer.endPage())
                        {
                            throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING,
                                                      C_MODULE,
                                                      "Ocurrio un error al imprimir el reporte."
                                                      );
                        }
                        if (!pRefreshObjClient(i, objClient))
                        {
                            return false;
                        }
                    }
                }

                if (!printer.endDoc())
                {
                    throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING,
                                              C_MODULE,
                                              "Ocurrio un error al imprimir el reporte."
                                              );
                }
                */
                return true;

            }
            catch (Exception ex)
            {
                cError.mngError(ex, "printPagePrinter", C_MODULE, "");
                return false;
            }
        }