示例#1
0
        public static void ExportToPDF(Page page, ReportViewer rptViewer, string fileName, PDFDeviceInfo deviceInfo)
        {
            Warning[] warnings;
            string[]  streamids;
            string    mimeType;
            string    encoding;
            string    extension;

            byte[] bytes = rptViewer.LocalReport.Render(
                deviceInfo.OutputFormat, deviceInfo.ToString(),
                out mimeType, out encoding,
                out extension, out streamids, out warnings);

            FileInfo fInfo = new FileInfo(Path.GetTempFileName());

            FileStream fs = new FileStream(fInfo.FullName, FileMode.Create);

            fs.Write(bytes, 0, bytes.Length);
            fs.Close();

            FileHelper.DownloadFile(page, fInfo.DirectoryName, fInfo.Name, fileName);
        }
示例#2
0
        public static void ExportToPDF(Page page, ReportViewer rptViewer, string fileName)
        {
            PDFDeviceInfo deviceInfo = new PDFDeviceInfo();

            ExportToPDF(page, rptViewer, fileName, deviceInfo);
        }