Export PDF not working

Stimulsoft Reports.WEB discussion
Post Reply
rodrigo.avots
Posts: 21
Joined: Tue Nov 22, 2016 2:15 pm

Export PDF not working

Post by rodrigo.avots »

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);
}
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Export PDF not working

Post by Lech Kulikowski »

Hello,

Please check the following sample:
https://github.com/stimulsoft/Samples-N ... rom%20Code

If the issue is still present, please send us a sample project that reproduces the issue for analysis.

Thank you.
rodrigo.avots
Posts: 21
Joined: Tue Nov 22, 2016 2:15 pm

Re: Export PDF not working

Post by rodrigo.avots »

Hy!

Here's an example, where I need to pass parameters (httppost) and export the report.
Could you help me?
Currently the reports are taking up a lot of memory and I believe that this way it will decrease.

Thanks!
Attachments
ExportReport.zip
(5.44 MiB) Downloaded 79 times
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Export PDF not working

Post by Lech Kulikowski »

Hello,

Please check the following article about caching:
https://www.stimulsoft.com/en/documenta ... ashing.htm

Thank you.
Post Reply