StellaOps.Workflow.Renderer.Svg

Renders laid-out workflow diagrams as SVG and PNG.

library
Component
Workflow
Licence
BUSL-1.1 (Workflow licence)
Target framework
net10.0
Latest release
1.0.1-20261118T121708Z

Install

dotnet add package StellaOps.Workflow.Renderer.Svg --version 1.0.1-20261118T121708Z

Namespaces

NamespaceTypes
StellaOps.Workflow.Renderer.Svg4

namespace StellaOps.Workflow.Renderer.Svg

TypeKindDescription
WorkflowRenderPngExporterclassExports SVG workflow diagrams as PNG images.
WorkflowRenderSvgDocumentrecordA rendered SVG workflow diagram and its size.
WorkflowRenderSvgRendererclassRenders positioned workflow diagrams as SVG, with a legend and the licence notice.
WorkflowRenderSvgServiceCollectionExtensionsclassRegisters the SVG renderer of workflow diagrams.

class WorkflowRenderPngExporter

public sealed class WorkflowRenderPngExporter

Exports SVG workflow diagrams as PNG images.

Members

MemberKindSummary
WorkflowRenderPngExporter()constructorCreates an instance of WorkflowRenderPngExporter.
ExportAsync(WorkflowRenderSvgDocument, string, float, CancellationToken)methodDraws an SVG diagram on a white background and writes it as a PNG file, creating its directory.

constructor WorkflowRenderPngExporter() #

public WorkflowRenderPngExporter()

Creates an instance of WorkflowRenderPngExporter.

method ExportAsync(WorkflowRenderSvgDocument, string, float, CancellationToken) #

public Task ExportAsync(WorkflowRenderSvgDocument document, string pngPath, float scale = 2, CancellationToken cancellationToken = default)

Draws an SVG diagram on a white background and writes it as a PNG file, creating its directory.

Parameters

  • document: The SVG diagram.
  • pngPath: The PNG file to write.
  • scale: The scale of the image against the diagram size; 2 by default.
  • cancellationToken: Cancels the operation.

Returns

A task that completes when the file is written.

Exceptions

  • InvalidOperationException: The SVG cannot be loaded.

record WorkflowRenderSvgDocument

public sealed record WorkflowRenderSvgDocument

A rendered SVG workflow diagram and its size.

Members

MemberKindSummary
WorkflowRenderSvgDocument()constructorCreates an instance of WorkflowRenderSvgDocument.
HeightpropertyThe diagram height, in SVG user units.
SvgpropertyThe SVG markup.
WidthpropertyThe diagram width, in SVG user units.

constructor WorkflowRenderSvgDocument() #

public WorkflowRenderSvgDocument()

Creates an instance of WorkflowRenderSvgDocument.

property Height #

public required double Height { get; init; }

The diagram height, in SVG user units.

property Svg #

public required string Svg { get; init; }

The SVG markup.

property Width #

public required double Width { get; init; }

The diagram width, in SVG user units.

class WorkflowRenderSvgRenderer

public sealed class WorkflowRenderSvgRenderer : IWorkflowRenderSvgRenderer

Renders positioned workflow diagrams as SVG, with a legend and the licence notice.

Members

MemberKindSummary
WorkflowRenderSvgRenderer()constructorCreates an instance of WorkflowRenderSvgRenderer.
NoLicenceRecordNoticeconstantThe licence notice for a renderer host that loads no licence file, such as a build-time export: the component licence notice when no licence record is loaded.
Render(WorkflowRenderLayoutResult, string, string)methodRenders layout as an SVG document titled title.
RenderSvg(WorkflowRenderLayoutResult, string, string)methodRenders layout titled title.

constructor WorkflowRenderSvgRenderer() #

public WorkflowRenderSvgRenderer()

Creates an instance of WorkflowRenderSvgRenderer.

constant NoLicenceRecordNotice #

public const string NoLicenceRecordNotice = "No local licence record is loaded. See the applicable LICENSE and Order for permitted use."

The licence notice for a renderer host that loads no licence file, such as a build-time export: the component licence notice when no licence record is loaded. A host that runs the engine passes the notice of its latest licence evaluation instead (WorkflowLicenceSnapshot.NoticeHeadline).

method Render(WorkflowRenderLayoutResult, string, string) #

public WorkflowRenderSvgDocument Render(WorkflowRenderLayoutResult layout, string title, string licenceNotice)

Renders layout as an SVG document titled title. Every diagram carries licenceNotice as visible text along its bottom edge (data-licence-notice), XML-escaped.

method RenderSvg(WorkflowRenderLayoutResult, string, string) #

public string RenderSvg(WorkflowRenderLayoutResult layout, string title, string? licenceNotice)

Renders layout titled title. Every diagram carries a licence notice: licenceNotice when the host has one, otherwise the renderer’s notice for a host without a loaded licence record.

class WorkflowRenderSvgServiceCollectionExtensions

public static class WorkflowRenderSvgServiceCollectionExtensions

Registers the SVG renderer of workflow diagrams.

Members

MemberKindSummary
AddWorkflowSvgRenderer(IServiceCollection)extension methodRegisters WorkflowRenderSvgRendereras the host’s IWorkflowRenderSvgRenderer, which turns on the server-side SVG of the definition render graph (IncludeSvg).

extension method AddWorkflowSvgRenderer(IServiceCollection) #

public static IServiceCollection AddWorkflowSvgRenderer(this IServiceCollection services)

Registers WorkflowRenderSvgRendereras the host’s IWorkflowRenderSvgRenderer, which turns on the server-side SVG of the definition render graph (IncludeSvg).