Printing a Report from Code
Our sample projects and report templates can help you learn the basics of working with our products.A report can be rendered and sent to print directly from PHP code. This example loads a report, renders it, and prints it.
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.
$report = new StiReport();
$report->javascript->relativePath = '../';
$report->process();
$report->loadFile('../reports/SimpleList.mrt');
$report->render();
$report->print();
$report->printHtml();render()— builds the report document.print()— opens the browser print dialog for the rendered report.printHtml()— outputs the page together with the scripts so printing runs automatically.
render() builds the document and print() opens the browser print dialog for it; printHtml() outputs the page with the required scripts so printing runs automatically.