How i can response auto Print to PDF on browser
Posted: Wed May 13, 2015 5:21 am
How i can auto response Print to PDF on browser
Reporting tool and data analytics tools for creating reports and dashboards in ASP.NET, ASP.NET MVC, .NET Core, Blazor, Angular, PHP, Python, WPF, JavaScript, and Java applications.
https://forum.stimulsoft.com/
Code: Select all
// Print to PDF
public ActionResult Print()
{
StiReport report = new StiReport();
report.Load("D:\\ReportXmlAir.mrt");
report.Render(false);
MemoryStream stream = new MemoryStream();
StiPdfExportSettings settings = new StiPdfExportSettings();
settings.AutoPrintMode = StiPdfAutoPrintMode.Dialog;
StiPdfExportService service = new StiPdfExportService();
service.ExportPdf(report, stream, settings);
this.Response.Buffer = true;
this.Response.ClearContent();
this.Response.ClearHeaders();
this.Response.ContentType = "application/pdf";
//this.Response.AddHeader("Content-Disposition", "attachment; filename=\"report.pdf\"");
this.Response.ContentEncoding = Encoding.UTF8;
this.Response.AddHeader("Content-Length", stream.Length.ToString());
this.Response.BinaryWrite(stream.ToArray());
this.Response.End();
return View();
}