Printing the Report from Code
Our sample projects and report templates can help you learn the basics of working with our products.Render the report in React and start the print workflow with settings supplied by the application.
Printing from code. Load and render the report, apply the printer settings, and start the print workflow from application code.
Printing from code. Load and render the report, apply the printer settings, and start the print workflow from application code.
import { Stimulsoft } from 'stimulsoft-reports-js-react';
var report: Stimulsoft.Report.StiReport;
function printPdf_Click() {
window.Blob = Blob;
window.File = File;
report.printToPdf();
}
function printHtml_Click() {
report.print();
}
function App() {
report = new Stimulsoft.Report.StiReport();
report.loadFile('Reports/SimpleList.mrt');
return (
<div className='container'>
<h4>This sample demonstrates how to print a report:</h4>
<div className='container-button'>
<button onClick={printPdf_Click} className='button' title='Print Report as PDF File'>
Print PDF
</button>
<button onClick={printHtml_Click} className='button' title='Print Report as HTML File'>
Print HTML
</button>
</div>
</div>
);
}
export default App;report.printToPdf() prints through a generated PDF for pixel-accurate output, while report.print() uses the HTML print path — both open the browser print dialog for a loaded report.