Export Pipeline
Template Location
Property Value Default file name risksheetPdfExport.vmAttachment location Polarion document or template document Endpoint /api/pdfscriptRequires revision parameter
The template follows the same inheritance hierarchy as risksheet.json. If no risksheetPdfExport.vm is attached to the current document, Risksheet searches the template hierarchy. See Template Path Configuration .
Configuration Properties
Name Type Default Description risksheetPdfExport.vmstringrisksheetPdfExport.vmName of the Velocity template file for PDF export pdfExportConfigurationstringSee application Full content of the rendered PDF export template templateNamestringnullName of the template used when configuration is loaded from a template fromTemplatebooleanfalseWhether the PDF export configuration was loaded from a template configPathstringnullPath to the configuration file that was loaded
Export Script Scope Variables
The rendered JavaScript export script has access to these scope variables:
Variable Type Description exporterExportToPdfMain export engine with methods for generating PDF content PDFExportobjectPDF generation library GridPDFobjectGrid-to-PDF rendering engine isInComparebooleanWhether the export is running in comparison mode compareRevisionstringRevision being compared against (if in comparison mode) currentRevisionstringCurrent document revision showUnchangedbooleanWhether to include unchanged rows in comparison export
Export Methods
exportMainSheet
Exports the primary Risksheet grid to PDF.
Parameter Type Description hideColumnsstringComma-separated binding names of columns to hide during export
// Export full grid
exporter . exportMainSheet ();
// Export grid with specific columns hidden
exporter . exportMainSheet ( "internalNotes,debugColumn" );
Columns specified in hideColumns are temporarily hidden during export and restored after PDF generation.
exportSubTable
Exports a filtered sub-grid containing only rows where the specified control column has non-empty values.
Parameter Type Description controlColumnstringColumn binding used to filter rows
// Export mitigation tasks sub-table
exporter . exportSubTable ( "mitigationTask" );
exportDownstreamTable
Exports downstream traceability tables with deduplication based on control column values.
Parameter Type Description controlColumnstringColumn binding for downstream items
// Export unique downstream verification activities
exporter . exportDownstreamTable ( "verificationActivity" );
The deduplication logic tracks processed values to show each unique downstream relationship once.
exportRatingTable
Exports risk rating definition tables with three columns: ID, Label, and Description.
Parameter Type Description ratingIdstringRating definition key from config.ratings
// Export severity rating definitions
exporter . exportRatingTable ( "severity" );
// Export occurrence rating definitions
exporter . exportRatingTable ( "occurrence" );
exportEnumTable
Exports enumeration value tables showing ID, Label, and Description.
Parameter Type Description enumIdstringEnum definition key from config.enums
// Export risk category enum values
exporter . exportEnumTable ( "riskCategory" );
exportCustomTableData
Exports arbitrary tabular data with custom column definitions.
Parameter Type Description dataarrayArray of row objects columnsarrayColumn definitions with binding, header, width xposnumberOptional horizontal position yposnumberOptional vertical position
exporter . exportCustomTableData (
[{ item: "Safety Goal 1" , status: "Open" , priority: "High" }],
[
{ binding: "item" , header: "Item" , width: 200 },
{ binding: "status" , header: "Status" , width: 100 },
{ binding: "priority" , header: "Priority" , width: 100 }
]
);
The PDF export engine handles different column types automatically:
Column Type PDF Rendering Multi-enum Comma-separated text values Item link Label property text Server-rendered HTML Stripped to plain text Boolean Checkbox representation Empty cells Configurable emptyPlaceholder text
Regular enum fields export with display titles, but rating fields (numeric IDs) and user reference fields may export with IDs instead of display names. Use saved views as an alternative for consistent formatting.
Export Properties
Name Type Default Description emptyPlaceholderstringnullText to display in PDF for null or empty cells mergeCacheFlagbooleanSee application Affects how merged cells render in PDF export masterMergeOnlybooleanSee application Controls PDF table structure (flat vs. hierarchical row merging)
Validation Requirements
PDF export requires a clean document state:
Export is blocked if the sheet has unsaved changes (isDirty() returns true)
Export is blocked when comparison mode is active
Save the document before exporting to ensure the PDF reflects a consistent state
A progress notification displays during PDF generation with the message “Exporting to PDF - Please wait while the file is being generated.”
Multi-Page Behavior
When risk items span multiple pages, text from linked elements (hazard, hazardous situation, harm) may repeat on the next page for context. This is by design but can be interpreted as duplicate entries by reviewers. Cell height calculation may truncate text for linked elements in some cases.
Images on Multiple Pages
The doc.pageAdded event only applies to the page where it is called. To display a logo or header image on every page, call doc.pageAdded after each #newPage() invocation. It does not automatically repeat for table overflow pages.
// Add header to first page
doc . pageAdded ( function () {
// Draw logo/header
});
// After explicit page break
# newPage ()
doc . pageAdded ( function () {
// Must re-add for this page
});
Complete Example
## risksheetPdfExport.vm - FMEA PDF Export
#set($docTitle = $doc.moduleNameWithSpace)
#set($revision = $request.getParameter("revision"))
<script>
// Cover page
doc.header("FMEA Report: ${docTitle}");
doc.subheader("Revision: ${revision}");
// Main risk table
exporter.exportMainSheet("internalNotes");
// Rating definitions
#newPage()
doc.header("Rating Definitions");
doc.subheader("Severity Scale");
exporter.exportRatingTable("severity");
doc.subheader("Occurrence Scale");
exporter.exportRatingTable("occurrence");
doc.subheader("Detection Scale");
exporter.exportRatingTable("detection");
// Mitigation tasks
#newPage()
doc.header("Mitigation Tasks");
exporter.exportSubTable("mitigationTask");
</script>
Related Pages
Support Tickets Source Code
PdfExportConfigurationService.java
RisksheetViewServlet.java
ExportToPdf.ts
CommandFactory.ts
ExportToPdfCommand.ts