Fastreport da rapor çıktısını pdf dosya olarka saklamak
protected void Button2_Click1(object sender, EventArgs e)
{
//memorty stream
// No temp files
FastReport.Utils.Config.WebMode = true;
// Set PDF export props
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
pdfExport.ShowProgress = false;
pdfExport.Subject = "Subject";
pdfExport.Title = "xxxxxxx";
pdfExport.Compressed = true;
pdfExport.AllowPrint = true;
pdfExport.EmbeddingFonts = true;
// Load our report
FastReport.Report report = new FastReport.Report();
FastReport.EnvironmentSettings evn = new FastReport.EnvironmentSettings();
// evn.DatabaseLogin += new FastReport.DatabaseLoginEventHandler(evn_DatabaseLogin);
String DOSYA = Server.MapPath(@"~/FastPrint/DENEME.frx");
string Savepdffile= Server.MapPath(@"~//FastPrint/")+"File.pdf";
report.Load(DOSYA);
//report.SetParameterValue("ID", 123));
report.Prepare();
// Export report to PDF stream
MemoryStream strm = new MemoryStream();
report.Export(pdfExport, strm);
FileStream file = new FileStream(Savepdffile, FileMode.Create, FileAccess.Write);
strm.WriteTo(file);
file.Close();
strm.Close();
report.Dispose();
pdfExport.Dispose();
}
{
//memorty stream
// No temp files
FastReport.Utils.Config.WebMode = true;
// Set PDF export props
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
pdfExport.ShowProgress = false;
pdfExport.Subject = "Subject";
pdfExport.Title = "xxxxxxx";
pdfExport.Compressed = true;
pdfExport.AllowPrint = true;
pdfExport.EmbeddingFonts = true;
// Load our report
FastReport.Report report = new FastReport.Report();
FastReport.EnvironmentSettings evn = new FastReport.EnvironmentSettings();
// evn.DatabaseLogin += new FastReport.DatabaseLoginEventHandler(evn_DatabaseLogin);
String DOSYA = Server.MapPath(@"~/FastPrint/DENEME.frx");
string Savepdffile= Server.MapPath(@"~//FastPrint/")+"File.pdf";
report.Load(DOSYA);
//report.SetParameterValue("ID", 123));
report.Prepare();
// Export report to PDF stream
MemoryStream strm = new MemoryStream();
report.Export(pdfExport, strm);
FileStream file = new FileStream(Savepdffile, FileMode.Create, FileAccess.Write);
strm.WriteTo(file);
file.Close();
strm.Close();
report.Dispose();
pdfExport.Dispose();
}
Hiç yorum yok