Render a letter or report¶
Renders a concrete report/letter subclass's XML document into PDF bytes, reusing a previously rendered file when possible.
| Field | Value |
|---|---|
| Operation ID | OP-REPORTING-RENDER |
| Trigger | Caller invokes Reporting.ReportBase.Render(overwrite) directly, or it is invoked internally by Print a letter or report / Save a rendered report to disk |
| Inputs | overwrite flag |
| Outputs | Boolean success flag; populates m_reportFile with rendered PDF bytes |
| Primary components | Reporting.ReportBase.Render, Reporting.ReportBase.Create (overridable) |
| Entry point | SAIF.Services.Printing\Reporting\ReportBase.vb |
Steps¶
- Checks whether
m_reportFileis already populated andoverwriteisFalse— if so, short-circuits and returnsTruewithout re-rendering. (Note: clearing the internal error list happens inCreate, not here.) - Otherwise calls
Create(overwrite)— an overridable method; the concrete subclass (e.g., a specific letter type) builds theReporting.XDesignXDocumenttree, while the base implementation just clears the error list and returns the current, possibly-null, XML. - If the resulting
m_reportXmlis notNothingandReportPackageis non-empty: - Determines the security platform context: defaults to
clsSecurityPrincipal.Platform.Windows, switched toPlatform.Webif_environmentService.IsWebis true (seeIsWebconfiguration setting). - Constructs a
SAIF.Framework.Security.clsSecurityPrincipalfor that platform and callsGetDefaultPrinter()to setxPrint.Printer. > Origin:GetDefaultPrinter()is implemented inSAIF.Framework.Security.clsSecurityPrincipal(SAIF.BOF.Framework.Security, external package) and determines a default printer name based on platform and current principal.† - Calls
xPrint.previewDocument(m_ReportPackage, m_reportXml.ToXpression, OutputProfile)— delegates into Preview a document via xPression — storing the returned PDF bytes inm_reportFile. - Sets
result = True. - Any exception during the above is caught and recorded as an
ErrorDetailin theErrorslist. - On failure: the method returns
False(implicit, sinceresultwas never set toTruebefore the exception).
Process flow¶
flowchart TD
Start([Render called]) --> Cached{m_reportFile populated and overwrite=False?}
Cached -->|Yes| EndOk([Return True, no re-render])
Cached -->|No| CreateXml[Call Create - build XDesignXDocument]
CreateXml --> Check{m_reportXml not Nothing and ReportPackage non-empty?}
Check -->|No| EndFail([Return False])
Check -->|Yes| Platform[Determine security platform via IsWeb]
Platform --> Printer[GetDefaultPrinter via clsSecurityPrincipal]
Printer --> Preview[Call xPrint.previewDocument]
Preview --> EndOk2([Set result True, return True])
Preview -->|Exception| Error[Record ErrorDetail, return False]
Failure and edge-case behavior¶
- Exceptions during rendering are caught and recorded as an
ErrorDetailin theErrorslist rather than propagated to the caller.
Related documentation¶
Sources¶
SAIF.Services.Printing\Reporting\ReportBase.vb