Empty pdf

Stimulsoft Reports.PHP discussion
Post Reply
Posts: 1
Joined: Thu Mar 24, 2022 1:47 pm

Empty pdf

Post by Cmmchado2022 »

Hi guys
I need a help

require_once 'stimulsoft/helper.php';

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<title>Exporting a Report from Code</title>
<style>html, body { font-family: sans-serif; }</style>

<!-- Stimulsoft Reports.PHP scripts -->
<script src="scripts/stimulsoft.reports.js" type="text/javascript"></script>
<script src="scripts/stimulsoft.viewer.js" type="text/javascript"></script>
// Creating the default events handler
// Documentation: https://www.stimulsoft.com/en/documenta ... andler.htm
StiHelper::init('handler.php', 30);

<script type="text/javascript">
// Creating and loading the report template
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.fullScreenMode = true;

var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);

var report = Stimulsoft.Report.StiReport.createNewReport();

// Processing SQL data sources on the server-side
// Documentation: https://www.stimulsoft.com/en/documenta ... l_data.htm
this.report.onBeginProcessData = function (args) {
// Current data source name
var dataSource = args.dataSource;
// Connection string of the current data source
var connectionString = args.connectionString;
// SQL query string of the current data source
var queryString = args.queryString;

/*args.parameters["@IDCONF"] = 2;
args.parameters["@MES"] = "JANEIRO";
args.parameters["@ANO"] = "2022";

// Calling the server-side handler


var fileName = Stimulsoft.System.StiString.isNullOrEmpty(this.report.reportAlias) ? this.report.reportName : this.report.reportAlias;

// Getting the report file name
function exportToPdf() {

this.report.renderAsync(function() {
this.report.exportDocumentAsync(function (data) {
// Saving data to a file
Stimulsoft.System.StiObject.saveAs(data, this.fileName + ".pdf", "application/pdf");
}, Stimulsoft.Report.StiExportFormat.Pdf);

<body onLoad="exportToPdf()">

I need to build an API, to fill a datasource, and after, I have to generate a pdf file, but, it works, I have the situation, that my pdf is empty, the result from database, is not populating the report!
I need a guideline, because the work is already done, but I have this problem!

Lech Kulikowski
Posts: 4474
Joined: Tue Mar 20, 2018 5:34 am

Re: Empty pdf

Post by Lech Kulikowski »


Please send us a sample project that reproduces the issue for analysis.

Thank you.
Post Reply