Class AsposeAgentTimelinePdfRenderer

java.lang.Object
com.flowable.agent.engine.impl.report.AsposeAgentTimelinePdfRenderer
All Implemented Interfaces:
AgentTimelinePdfRenderer

public class AsposeAgentTimelinePdfRenderer extends Object implements AgentTimelinePdfRenderer
AgentTimelinePdfRenderer implementation that renders an AgentTimelineReport as an audit-complete, visually structured PDF using Aspose.
  • Field Details

    • TIMESTAMP_FORMATTER

      protected static final DateTimeFormatter TIMESTAMP_FORMATTER
    • LOGO_RESOURCE

      protected static final String LOGO_RESOURCE
      See Also:
    • FONT_MONOSPACE

      protected static final String FONT_MONOSPACE
      See Also:
    • FONT_COVER_TITLE

      protected static final float FONT_COVER_TITLE
      See Also:
    • FONT_COVER_SUBTITLE

      protected static final float FONT_COVER_SUBTITLE
      See Also:
    • FONT_SECTION_HEADING

      protected static final float FONT_SECTION_HEADING
      See Also:
    • FONT_SUB_HEADING

      protected static final float FONT_SUB_HEADING
      See Also:
    • FONT_AGENT_HEADING

      protected static final float FONT_AGENT_HEADING
      See Also:
    • FONT_OPERATION_HEADING

      protected static final float FONT_OPERATION_HEADING
      See Also:
    • FONT_BODY

      protected static final float FONT_BODY
      See Also:
    • FONT_LABEL

      protected static final float FONT_LABEL
      See Also:
    • FONT_SMALL

      protected static final float FONT_SMALL
      See Also:
    • FONT_MONO

      protected static final float FONT_MONO
      See Also:
    • FONT_OVERVIEW_TABLE

      protected static final float FONT_OVERVIEW_TABLE
      See Also:
    • INDEX_LINE_GAP

      protected static final float INDEX_LINE_GAP
      See Also:
    • INDEX_LEVEL2_INDENT

      protected static final float INDEX_LEVEL2_INDENT
      See Also:
    • INDEX_LEVEL3_INDENT

      protected static final float INDEX_LEVEL3_INDENT
      See Also:
    • CLIP_BOTTOM_EXPANSION_RATIO

      protected static final double CLIP_BOTTOM_EXPANSION_RATIO
      See Also:
    • LINE_SPACING_RATIO

      protected static final float LINE_SPACING_RATIO
      See Also:
    • PAGE_MARGIN_SIDE

      protected static final double PAGE_MARGIN_SIDE
      See Also:
    • PAGE_MARGIN_TOP

      protected static final double PAGE_MARGIN_TOP
      See Also:
    • PAGE_MARGIN_BOTTOM

      protected static final double PAGE_MARGIN_BOTTOM
      See Also:
    • CONTENT_WIDTH

      protected static final double CONTENT_WIDTH
      See Also:
    • LOGO_WIDTH

      protected static final double LOGO_WIDTH
      See Also:
    • LOGO_HEIGHT

      protected static final double LOGO_HEIGHT
      See Also:
    • COLOR_TEXT

      protected static final com.aspose.pdf.Color COLOR_TEXT
    • COLOR_MUTED

      protected static final com.aspose.pdf.Color COLOR_MUTED
    • COLOR_ACCENT

      protected static final com.aspose.pdf.Color COLOR_ACCENT
    • COLOR_KPI_BG

      protected static final com.aspose.pdf.Color COLOR_KPI_BG
    • COLOR_KV_BG

      protected static final com.aspose.pdf.Color COLOR_KV_BG
    • COLOR_BLOCK_BG

      protected static final com.aspose.pdf.Color COLOR_BLOCK_BG
    • COLOR_BORDER

      protected static final com.aspose.pdf.Color COLOR_BORDER
    • TYPE_COLORS

      protected static final Map<String,com.aspose.pdf.Color> TYPE_COLORS
  • Constructor Details

    • AsposeAgentTimelinePdfRenderer

      public AsposeAgentTimelinePdfRenderer()
  • Method Details

    • render

      public void render(AgentTimelineReport report, OutputStream outputStream)
      Specified by:
      render in interface AgentTimelinePdfRenderer
    • pageMargin

      protected com.aspose.pdf.MarginInfo pageMargin()
    • expandTextClipBoxes

      protected void expandTextClipBoxes(com.aspose.pdf.Document document)
      Fixes descender clipping at its true root cause. Aspose's paragraph/flow layout wraps every text line in a clip rectangle ("x y w h re W n") whose bottom edge sits only the font's descent (~0.207 x em) below the baseline. A glyph descender (g, y, p) extends ~0.21-0.25 x em below the baseline, so its tip falls outside the clip and strict viewers (Chrome, Adobe, pdf.js) chop it - macOS CoreGraphics happens to ignore the clip, which masked the bug in earlier PNG checks. No line-spacing value, spacing mode, margin, table-cell wrap or explicit rectangle moves this bottom edge: it is pinned to the font descent. Only removing/enlarging the clip helps, and enlarging a clip is always safe (a clip only ever hides content, so a bigger one reveals more).

    • expandClipsIn

      protected void expandClipsIn(com.aspose.pdf.OperatorCollection contents)
      Widens every "re W n" text-clip rectangle in one operator collection by lowering its bottom edge.
    • isClipRectangle

      protected boolean isClipRectangle(com.aspose.pdf.OperatorCollection contents, int index, int count)
      True when the operator at index (an Re) is immediately used as a clip path ("W n").
    • newPage

      protected com.aspose.pdf.Page newPage(com.aspose.pdf.Document document)
    • renderCover

      protected void renderCover(com.aspose.pdf.Page page, AgentTimelineReport report)
    • addLogo

      protected void addLogo(com.aspose.pdf.Page page)
    • coverSubtitle

      protected String coverSubtitle(AgentTimelineReport report)
    • renderIntroAndInstanceDetails

      protected void renderIntroAndInstanceDetails(com.aspose.pdf.Page page, AgentTimelineReport report)
    • hasInstanceDetails

      protected boolean hasInstanceDetails(AgentTimelineReport report)
    • hasAgentInstanceDetails

      protected boolean hasAgentInstanceDetails(AgentTimelineReport report)
    • renderInstanceDetails

      protected void renderInstanceDetails(com.aspose.pdf.Page page, AgentTimelineReport report)
    • renderAgentInstanceDetails

      protected void renderAgentInstanceDetails(com.aspose.pdf.Page page, AgentTimelineReport report)
      Single-agent-instance header, shown in place of the work-instance details table.
    • scopeTypeLabel

      protected String scopeTypeLabel(String scopeType)
      Maps a raw scope type to a human-readable label ("cmmn" to "Case", "bpmn" to "Process"); null/blank stays null.
    • addKeyValueRow

      protected void addKeyValueRow(com.aspose.pdf.Table table, String label, String value)
    • renderSummaryKpis

      protected void renderSummaryKpis(com.aspose.pdf.Page page, AgentTimelineReport report)
    • renderUnpricedModelsNote

      protected void renderUnpricedModelsNote(com.aspose.pdf.Page page, AgentTimelineReport report)
      When any chat model on the timeline has no configured price, its cost was counted as 0 and the total is understated - surface this the same way the UI does (a muted note plus the distinct unpriced model names).
    • addKpiRow

      protected void addKpiRow(com.aspose.pdf.Table table, String label1, String value1, String label2, String value2)
    • addKpiCell

      protected void addKpiCell(com.aspose.pdf.Row row, String label, String value)
    • renderTableOfContents

      protected void renderTableOfContents(com.aspose.pdf.Page tocPage)
    • margin

      protected com.aspose.pdf.MarginInfo margin(com.aspose.pdf.Table table)
    • numberedInvocations

      Builds the numbered invocation list in definition/detail order, assigning the same hierarchical numbers ("1.1", "1.2", "2.1", ...) that the detail section uses so the Overview and Details stay in sync.
    • renderOverview

      protected void renderOverview(com.aspose.pdf.Page page, AgentTimelineReport report)
    • groupByConcurrency

    • overviewTable

      protected com.aspose.pdf.Table overviewTable(List<AsposeAgentTimelinePdfRenderer.NumberedInvocation> group)
    • addOverviewHeaderCell

      protected void addOverviewHeaderCell(com.aspose.pdf.Row row, String label)
    • addOverviewCell

      protected void addOverviewCell(com.aspose.pdf.Row row, String value, boolean bold)
    • renderInvocationDetails

      protected void renderInvocationDetails(com.aspose.pdf.Page page, AgentTimelineReport report, com.aspose.pdf.Page tocPage)
    • renderInvocation

      protected void renderInvocation(com.aspose.pdf.Page page, AgentInvocationReport invocation, String number, com.aspose.pdf.Page tocPage)
    • renderInvocationMeta

      protected void renderInvocationMeta(com.aspose.pdf.Page page, AgentInvocationReport invocation)
      Renders the per-invocation metrics as a whitespace-rich bullet list, one metric per line.
    • bullet

      protected com.aspose.pdf.TextFragment bullet(String value, boolean last)
      A single "• label" line for the invocation metrics list. The last item carries extra bottom whitespace.
    • renderGuardrails

      protected void renderGuardrails(com.aspose.pdf.Page page, AgentInvocationReport invocation)
      Renders the guardrails sub-section for an invocation: a summary line (evaluated / passed / fired / pass rate) followed by a table with a row per evaluation. Skips entirely when no guardrails were evaluated.
    • guardrailOutcome

      protected String guardrailOutcome(AgentGuardrailReport guardrail)
      "Passed" when the guardrail passed, otherwise the fired action (falling back to "Fired").
    • addGuardrailHeaderCell

      protected void addGuardrailHeaderCell(com.aspose.pdf.Row row, String label)
    • addGuardrailCell

      protected void addGuardrailCell(com.aspose.pdf.Row row, String value, boolean bold)
    • renderPart

      protected void renderPart(com.aspose.pdf.Page page, AgentExchangePartReport part, com.aspose.pdf.Page tocPage)
    • addPageFooters

      protected void addPageFooters(com.aspose.pdf.Document document)
    • sectionHeading

      protected com.aspose.pdf.TextFragment sectionHeading(String value)
      A top-level numbered section heading (not part of the index).
    • subHeading

      protected com.aspose.pdf.TextFragment subHeading(String value, double topMargin)
    • tocHeading

      protected com.aspose.pdf.Heading tocHeading(int level, String value, float fontSize, com.aspose.pdf.Color color, com.aspose.pdf.Page tocPage)
    • heading

      protected com.aspose.pdf.TextFragment heading(String value, float fontSize, com.aspose.pdf.Color color)
    • margin

      protected com.aspose.pdf.MarginInfo margin(com.aspose.pdf.TextFragment fragment)
      Ensures the fragment has a mutable MarginInfo (Aspose leaves it null by default) and returns it.
    • text

      protected com.aspose.pdf.TextFragment text(String value, float fontSize, com.aspose.pdf.Color color, boolean bold)
    • applyFullLineHeight

      protected void applyFullLineHeight(com.aspose.pdf.TextFragmentState state, float fontSize)
    • spacedText

      protected com.aspose.pdf.TextFragment spacedText(String value, float fontSize, com.aspose.pdf.Color color, double topMargin)
    • spacedText

      protected com.aspose.pdf.TextFragment spacedText(String value, float fontSize, com.aspose.pdf.Color color, double topMargin, boolean bold)
    • definitionLabel

      protected String definitionLabel(AgentInstanceReport instance)
    • invocationLabel

      protected String invocationLabel(AgentInvocationReport invocation)
    • partLabel

      protected String partLabel(AgentExchangePartReport part)
    • firstModel

      protected String firstModel(AgentInvocationReport invocation)
    • formatTokens

      protected String formatTokens(long tokens)
    • formatCost

      protected String formatCost(double cost)
    • formatInstant

      protected String formatInstant(Instant instant)
    • formatInstantOrNull

      protected String formatInstantOrNull(Instant instant)
    • formatDuration

      protected String formatDuration(Long millis)
    • formatDuration

      protected String formatDuration(long millis)
    • startMillis

      protected long startMillis(AgentInvocationReport invocation)
    • endMillis

      protected long endMillis(AgentInvocationReport invocation)
    • endInstant

      protected Instant endInstant(AgentInvocationReport invocation)
      Resolves the invocation's end instant, falling back to start + duration when endTime is absent.
    • typeColor

      protected com.aspose.pdf.Color typeColor(String type)
    • buildTypeColors

      protected static Map<String,com.aspose.pdf.Color> buildTypeColors()
    • fromHex

      protected static com.aspose.pdf.Color fromHex(String hex)
    • safe

      protected static String safe(String value)