Exporting a Report from Code with Changing Export Settings
Our sample projects and report templates can help you learn the basics of working with our products.Server-side exports can be fine-tuned with a settings object. This example exports to PDF with custom metadata and saves it to a file.
Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
Each format has a settings class (here
Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
$report->engine = StiEngineType::ServerNodeJS;
$report->process();
$report->loadFile('reports/SimpleList.mrt');
$report->render();
$settings = new StiPdfExportSettings();
$settings->creatorString = 'My Company Name';
$settings->embeddedFonts = false;
$filePath = 'reports/SimpleList.pdf';
$report->exportDocument(StiExportFormat::Pdf, $settings, false, $filePath);engine = StiEngineType::ServerNodeJS— renders on the server with the Node.js engine.new StiPdfExportSettings()— the PDF-specific settings object (creatorString,embeddedFonts, …).exportDocument(Pdf, $settings, false, $filePath)— exports with those settings and writes the result straight to a file.
Each format has a settings class (here
StiPdfExportSettings) passed to exportDocument; the extra arguments let you write the result straight to a file on the server.