@model Doc.Web.Models.Vendor.VendorCoverSheetFormModel
@using (Html.BeginForm())
{
<input type="submit" value="Save" id="btnSave" />
var typeReportSource = new TypeReportSource() { TypeName = "Doc.Web.Reports.SquadCheck.SquadCheck, Doc.Web" };
typeReportSource.Parameters.Add("project", "TEST");
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl("/api/reports/")
.TemplateUrl("/Content/ReportViewer/templates/telerikReportViewerTemplate.html")
.ReportSource(typeReportSource)
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.FIT_PAGE_WIDTH)
.Scale(1.0)
.PersistSession(false)
)
report is displaying fine and I want to save this report as a .pdf file to hard drive location, in HTTP post Action
[HttpPost]
public ActionResult Report(VendorCoverSheetFormModel model)
{
// here I need to include the code for .pdf saving
return View();
}
I have referred to following articles but I guess they are for asp.net web pages. How to modify this code to suit HTML5 report viewer?
http://www.telerik.com/support/kb/reporting/designing-reports/saving-a-report-into-pdf-format-programmatically.aspx
http://www.telerik.com/help/reporting/programmatic-exporting-report.html
8 Answers, 1 is accepted
SN
I want to save the pdf On server
The approach described in the Exporting Report Programmatically help article can be used to print on the server an instance of your report.
Other approach is to use the REST API and make the needed requests to register client, create instance, request document and retrieve it. For more details take a look at the Request Document help article.
I hope this helps you.
Regards,
Stef
Telerik
New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.
Hi Chamara,
I was wondering if you ever figured this out. I am trying to do the same thing.
Please test exporting programmatically the report via ReportProcessor - Exporting Report Programmatically.
I hope this helps.
Regards,
Stef
Telerik
I've been trying that, to no avail.
Right now I'm getting a file not found error even though the full file path it details in the error is correct.
Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
Telerik.Reporting.UriReportSource uriReportSource = new Telerik.Reporting.UriReportSource();
uriReportSource.Uri = "Reports\\NominationPaper.trdx";
Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", uriReportSource, deviceInfo);
The UriReportSource.Uri property is a string (the path to TRDX file on the server). In case of a web application, you can use the Server.MapPath to map the relative path.
About passing parameters, the ReportSource.Parameters collection is mapped by key (case sensitive) to the report's ReportParameters collection. For more details, please check Report Sources.
Regards,
Stef
Telerik