Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
cómo descargar jsreport sin abrir usando c# en .Net

Estoy Uso JS Report para ver. Este código procesa el archivo y lo guarda en el directorio raíz. Pero quiero que el archivo se descargue directamente, no se abra para verlo.

 var header = await _jsReportMVCService.RenderViewToStringAsync(HttpContext, RouteData, "Header", new { }); var footer = await _jsReportMVCService.RenderViewToStringAsync(HttpContext, RouteData, "Footer", new { }); HttpContext.JsReportFeature() .Recipe(Recipe.ChromePdf) .Configure((r) => { //r.Options = new RenderOptions //{ // Timeout = 600000 //}; r.Template.Chrome = new Chrome { HeaderTemplate = header, FooterTemplate = footer, DisplayHeaderFooter = true, MarginTop = "1cm", MarginLeft = "2cm", MarginBottom = "2cm", MarginRight = "1.5cm", Format = "A3" }; }); HttpContext.JsReportFeature().OnAfterRender((renderer) => { using (var file = System.IO.File.Open("EmployeesList.pdf", FileMode.Create)) { renderer.Content.CopyTo(file); } renderer.Content.Seek(0, SeekOrigin.Begin); });
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes descargar un JSReport como este

 [MiddlewareFilter(typeof(JsReportPipeline))] public IActionResult InvoiceDownload() { HttpContext.JsReportFeature().Recipe(Recipe.PhantomPdf) .OnAfterRender((r) => HttpContext.Response.Headers["Content-Disposition"] = "attachment; filename=\"myReport.pdf\""); return View("Invoice", InvoiceModel.Example()); }

Puede obtener ayuda del ejemplo básico oficial de asp.net .

Espero que esto te ayude

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!