コード例 #1
0
ファイル: PPT_Operator.cs プロジェクト: obush467/common
        public void Print(FileInfo document, PrinterSettings printerSettings)
        {
            PowerPoint.Presentation pptPresentation = null;
            try
            {
                pptPresentation = pptApplication.Presentations.Open(document.FullName,
                                                                    MsoTriState.msoTrue, MsoTriState.msoTrue,
                                                                    MsoTriState.msoFalse);
                pptPresentation.PrintOptions.NumberOfCopies = printerSettings.Copies;
                pptPresentation.PrintOptions.ActivePrinter  = printerSettings.PrinterName;
                //if(printerSettings.CanDuplex) pptPresentation.PrintOptions.can
                pptPresentation.PrintOut();
#if DEBUG
                Logger.Logger.Debug("Отпечатано " + document.FullName);
#endif
            }
            catch (Exception printerror)
            {
#if DEBUG
                Logger.Logger.Debug(printerror.Message);
#else
                Logger.Logger.Log.Error(printerror.Message);
#endif
            }
            finally
            {
                pptPresentation.Close();
            }
        }