示例#1
0
        protected void CarregaPdf(byte[] byArquivos)
        {
            try
            {
                StiReport           stiRelatorio = new StiReport();
                StiPdfExportService service      = new StiPdfExportService();
                MemoryStream        stream       = new MemoryStream();
                BinaryWriter        Writer       = null;
                string Name = @"C:\Users\wcfeitosa\Desktop\GetPdfApi\GetPdfApi\Relatorio\R1300130029.mrt";

                DataTable dtRelatorio = new DataTable();
                dtRelatorio.Columns.Add("dado", typeof(System.Byte[]));

                DataRow dtRow = dtRelatorio.NewRow();

                dtRow["dado"] = byArquivos;
                dtRelatorio.Rows.Add(dtRow);

                stiRelatorio.Load(Name);
                stiRelatorio.RegData(dtRelatorio);
                stiRelatorio.Compile();
                stiRelatorio.Render();

                service.ExportPdf(stiRelatorio, stream);
                service.Export(stiRelatorio, "MyReportTEste.pdf");
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#2
0
        private void UtbmMain_ToolClick(object sender, ToolClickEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                switch (e.Tool.Key.ToLower())
                {
                case "btprint":
                    //stiReport.Print(true);
                    stiViewerControl1.InvokeClickPrintButton();
                    break;

                case "btexportpdf":
                    //Stimulsoft.Report.SaveLoad.StiDocumentPageSLService serve = new Stimulsoft.Report.SaveLoad.StiDocumentPageSLService();
                    //StiPdfExportService pdfExport = new StiPdfExportService();

                    //StiPdfExportSettings pdfSettings = new StiPdfExportSettings();
                    ////pdfSettings.

                    //stiReport.ExportDocument(StiExportFormat.Pdf, "");

                    StiPdfExportService  service  = new StiPdfExportService();
                    StiPdfExportSettings settings = new StiPdfExportSettings();



                    MemoryStream stream = new MemoryStream();
                    service.ExportPdf(stiReport, stream, settings);
                    service.Export(stiReport, "test.pdf");
                    break;
                }
            }
            catch (Exception ex)
            {
                WfShowErrorMsg(ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }