Export PDF not working
Posted: Mon Sep 12, 2022 2:43 pm
Hi!
I have a problem with export pdf or rtf by code.
I pass the parameters directly to my controller and load the data into stireport, but it doesn't directly export to a file.
If I put it to view(StiMvcViewer) it works.
I'm having problems with memory usage on the server(iis), so I want to export directly to the file without using the cache.
What could be wrong?
Current version 2018.2.2.0
Evaluation test 2022.3.5.0 does not work
//Button ExportPDF - script
function onExportarPDF() {
var postEquiptos = JSON.stringify(getParamsEquiptos());
//Passa os parametros para Json
var postData = {};
postData['sFiltro'] = JSON.stringify(getParamsEquiptos())
postData['reportId'] = reportSelected;
postData['sParametros'] = JSON.stringify(getParams(false));
OnLoading();
//
var postDataE = { sFiltro: postEquiptos };
$.ajax({
url: 'Home/actionExportPDF',
type: 'POST',
data: postData,
dataType: "json",
traditional: true,
success: function (result) { sucesso(); },
error: function (result) { erro(); },
});
}
function sucesso() {
OnLoaded();
}
function erro() {
OnLoaded();
alert("Atenção!\nOcorreu um erro na exportação do arquivo!");
}
//Controller
[HttpPost]
public ActionResult actionExportPDF(string reportId, string sParametros, string sFiltro)
{
....
StiReport report = new StiReport();
....
// Create an PDF settings instance. You can change export settings.
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
settings.ImageResolution = 500;
settings.ImageQuality = 1.00f;
return StiMvcReportResponse.ResponseAsPdf(report, settings);
}
I have a problem with export pdf or rtf by code.
I pass the parameters directly to my controller and load the data into stireport, but it doesn't directly export to a file.
If I put it to view(StiMvcViewer) it works.
I'm having problems with memory usage on the server(iis), so I want to export directly to the file without using the cache.
What could be wrong?
Current version 2018.2.2.0
Evaluation test 2022.3.5.0 does not work
//Button ExportPDF - script
function onExportarPDF() {
var postEquiptos = JSON.stringify(getParamsEquiptos());
//Passa os parametros para Json
var postData = {};
postData['sFiltro'] = JSON.stringify(getParamsEquiptos())
postData['reportId'] = reportSelected;
postData['sParametros'] = JSON.stringify(getParams(false));
OnLoading();
//
var postDataE = { sFiltro: postEquiptos };
$.ajax({
url: 'Home/actionExportPDF',
type: 'POST',
data: postData,
dataType: "json",
traditional: true,
success: function (result) { sucesso(); },
error: function (result) { erro(); },
});
}
function sucesso() {
OnLoaded();
}
function erro() {
OnLoaded();
alert("Atenção!\nOcorreu um erro na exportação do arquivo!");
}
//Controller
[HttpPost]
public ActionResult actionExportPDF(string reportId, string sParametros, string sFiltro)
{
....
StiReport report = new StiReport();
....
// Create an PDF settings instance. You can change export settings.
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
settings.ImageResolution = 500;
settings.ImageQuality = 1.00f;
return StiMvcReportResponse.ResponseAsPdf(report, settings);
}