示例#1
0
        //------------------------------------------------------------------------------------------07.03.2005
    #if !WindowsCE
        /// <summary>Prints the specified PDF document after that it has been created.</summary>
        /// <param name="report">Report object that creates the PDF document</param>
        /// <exception cref="ReportException">
        /// The acrobat reader has not been installed, the registry entry is invalid or the reader cannot be started.
        /// </exception>
        /// <remarks>
        /// This method will create the specified PDF document.
        /// The resulting file will be stored in the current user's temporary folder.
        /// After that the document will be printed with the acrobat reader.
        /// </remarks>
        /// <example>
        /// <code>
        /// RT.PrintPDF(new DetailReport());
        /// </code>
        /// </example>
        public static void PrintPDF(Report report)
        {
            String sFileName = Path.GetTempFileName();

            report.Save(sFileName);
            PrintPDF(sFileName);
        }
示例#2
0
        //------------------------------------------------------------------------------------------07.03.2005
    #if !WindowsCE
        /// <summary>Shows the specified PDF document in a maximized window after that it has been created.</summary>
        /// <param name="report">Report object that creates the PDF document</param>
        /// <exception cref="ReportException">
        /// The acrobat reader has not been installed, the registry entry is invalid or the reader cannot be started.
        /// </exception>
        /// <remarks>
        /// This method will create the specified PDF document.
        /// The resulting file will be stored in the current user's temporary folder.
        /// After that the document will be displayed in the acrobat reader in a maximized window.
        /// </remarks>
        /// <example>
        /// <code>
        /// RT.ViewPDF(new DetailReport());
        /// </code>
        /// </example>
        public static void ViewPDF(Report report)
        {
      #if !NETCOREAPP
            System.Windows.Forms.Form   form    = System.Windows.Forms.Form.ActiveForm;
            System.Windows.Forms.Cursor cur_Old = System.Windows.Forms.Cursors.Default;
            try {
                if (form != null)
                {
                    cur_Old     = form.Cursor;
                    form.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                }
      #endif

            String sFileName = Path.GetTempFileName();
            report.Save(sFileName);
            ViewPDF(sFileName);

      #if !NETCOREAPP
        }
        finally {
            if (form != null)
            {
                form.Cursor = cur_Old;
            }
        }
      #endif
        }
示例#3
0
     //------------------------------------------------------------------------------------------07.03.2005
 #if !WindowsCE
     /// <summary>Shows the specified PDF document in a maximized window after that it has been created.</summary>
     /// <param name="report">Report object that creates the PDF document</param>
     /// <param name="sFileName">File name of the new PDF document</param>
     /// <exception cref="ReportException">
     /// The acrobat reader has not been installed, the registry entry is invalid or the reader cannot be started.
     /// </exception>
     /// <remarks>
     /// This method will create the specified PDF document.
     /// If the file name is relative, the file will be created in the current user's temporary folder.
     /// If it exists, the name of the file will be made unique with a time stamp.
     /// If the specified file name is absolute, it will be overwritten if it exists.
     /// After that the document will be displayed in the acrobat reader in a maximized window.
     /// </remarks>
     /// <example>
     /// <code>
     /// RT.ViewPDF(new DetailReport(), "DetailReport.pdf");
     /// </code>
     /// </example>
     public static void ViewPDF(Report report, String sFileName)
     {
         if (!Path.IsPathRooted(sFileName))
         {
             sFileName = Path.Combine(Path.GetTempPath(), sFileName);
         }
         if (File.Exists(sFileName))
         {
             String sDateTime = DateTime.Now.ToString("yyyyMMdd\\_HHmmss");
             String s         = Path.GetFileNameWithoutExtension(sFileName) + "_" + sDateTime + Path.GetExtension(sFileName);
             sFileName = Path.Combine(Path.GetDirectoryName(sFileName), s);
         }
         else
         {
             Directory.CreateDirectory(Path.GetDirectoryName(sFileName));
         }
         report.Save(sFileName);
         ViewPDF(sFileName);
     }