Changing an Export Settings on the Server-Side
Our sample projects and report templates can help you learn the basics of working with our products.When the user exports from the viewer, the export settings can be adjusted on the PHP server through the
Change file name and format settings.
How it works. The event runs on the server, so export options are applied centrally regardless of what the user clicks in the viewer.
onBeginExportReport event.Change file name and format settings.
$viewer->onBeginExportReport = function (StiExportEventArgs $args) {
$args->fileName = "MyExportedFileName.$args->fileExtension";
if ($args->format == StiExportFormat::Pdf) {
/** @var StiPdfDashboardExportSettings $settings */
$settings = $args->settings;
$settings->orientation = StiPageOrientation::Landscape;
$settings->paperSize = PaperKind::A4;
}
};onBeginExportReport— fires before the export;$args->settingsholds the format-specific options.$args->fileName— override the download name; PDF dashboard settings tune orientation and paper size.
How it works. The event runs on the server, so export options are applied centrally regardless of what the user clicks in the viewer.