Problem generating a PDF

Stimulsoft Reports.WEB discussion
Post Reply
gabrielw3n
Posts: 14
Joined: Mon Aug 21, 2017 5:10 pm

Problem generating a PDF

Post by gabrielw3n »

Hi.

I'm following this example:
https://www.stimulsoft.com/en/samples/j ... ort-to-pdf

I'm trying to export a MRT file to PDF directly.

So I downloaded the github example and when I access it, it works and bring all the data, everything fine.

But when I try to load my own MRT file, which connects to a local database and fill some data with databand, I get the PDF only with the static values but the database values are no printed.

Here's my code:

Code: Select all

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Export report to PDF</title>
	
	<!-- Stimusloft Reports.JS -->
	<script src="../scripts/stimulsoft.reports.js" type="text/javascript"></script>
</head>
<body>
	Load 'SimpleList' report template, render and export it.
	<br><br>
	
	<script type="text/javascript">
		// Create a new report instance
		var report = new Stimulsoft.Report.StiReport();
		// Load report from url
		report.loadFile("reports/SimpleList.mrt");
		// Render report
		report.render();
		
		// Export report to PDF format and save to file
		function saveReportPdf() {
			// Export to PDF
			var pdfData = report.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf);
			
			// Get report file name
			var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;
			// Save data to file
			Object.saveAs(pdfData, fileName + ".pdf", "application/pdf");
		}
	</script>
	
	<a href="#" onclick="saveReportPdf()">Save PDF report to file</a><br>
	<br><br>
	<div id="htmlContainer"></div>
</body>
</html>
Can someone help me?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Problem generating a PDF

Post by Alex K. »

Hello,

Please send us your report template for analysis.

Thank you.
Post Reply