Skip to content

Demo bring your own html and svg - #1

Merged
ellykits merged 4 commits into
mainfrom
demo-byo-html-charts
Jul 5, 2026
Merged

Demo bring your own html and svg#1
ellykits merged 4 commits into
mainfrom
demo-byo-html-charts

Conversation

@ellykits

@ellykits ellykits commented Jul 5, 2026

Copy link
Copy Markdown
Owner

No description provided.

ellykits added 4 commits July 6, 2026 00:48
Demonstrate the bring-your-own-HTML path: a new A4 "Sales Dashboard" sample
composes pie, bar, and line charts as inline SVG (SVG 1.1 core) injected via
addRawHtml, so the same document renders in browsers, WebView, and — with the
new Batik drawer — the desktop PDF.

- spooler desktop: add openhtmltopdf-svg-support and register BatikSVGDrawer so
  inline SVG renders in generated PDFs.
- demo: Charts.kt builds the three chart SVGs from plain data; salesDashboard
  document wires them; new card appears in the demo.
- tests: ChartsTest covers SVG structure; a desktop integration test renders
  inline SVG to a real PDF.
…mples

Promote the chart builders (pieChartSvg/barChartSvg/lineChartSvg + Slice/Bar/
Point) from the demo into spooler commonMain as public, KDoc'd API, reusing the
library's escapeHtml; move ChartsTest alongside them.

Add three literal bring-your-own-HTML demo samples that use no drawing code:
- Promo Flyer and Member Card — whole documents authored as inline-styled HTML
  passed to addRawHtml (logo embedded as a data URI).
- Sales Report — a report snippet embedding a chart as an <img> PNG; the PNG is
  a library barChartSvg pre-rendered once to a base64 constant in ChartImage.kt.

The Sales Dashboard sample now consumes the library chart API. Update the spec.
The library is not a charting library, so drop pieChartSvg/barChartSvg/
lineChartSvg and the Slice/Bar/Point types from spooler. Add one generic
UnifiedDocument.addSvg(svg) that embeds any SVG graphic as a centered block,
rendered into the desktop PDF by the Batik drawer.

Demo: draw a single bar chart with demo-local code (BarChart.kt) and embed it in
the Sales Report via addSvg. Drop the multi-chart Sales Dashboard and the
PNG-image report. Promo Flyer and Member Card are unchanged.
@ellykits ellykits changed the title Demo byo html charts Demo bring your own html and svg Jul 5, 2026
@ellykits
ellykits merged commit dcdc921 into main Jul 5, 2026
1 check passed
@ellykits
ellykits deleted the demo-byo-html-charts branch July 5, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant