@sitelensapi/report-pdf
v0.1.0
Published
SiteLens Reports PDF export — Chromium-rendered static PDF from canonical report.html (Playwright)
Maintainers
Readme
@sitelensapi/report-pdf
Chromium-rendered PDF export of existing SiteLens report.html.
Source of truth
- HTML (
report.html) is the canonical interactive report. - PDF is a static export of that HTML — not a separate report model or renderer.
- PDF generation is independent of the scenario/test execution browser. A flow run in Firefox or WebKit can still export PDF via Playwright-managed Chromium.
Requirements
- Node 20+
- Playwright peer dependency with a Chromium-compatible browser installed:
- Preferred: Playwright-managed Chromium (
sitelens setuporpnpm exec playwright install chromium) - Optional: system Chrome or Edge when explicitly requested (
channel: "chrome" | "msedge")
- Preferred: Playwright-managed Chromium (
- Firefox and WebKit are not supported PDF backends.
API
import { exportReportPdf, ReportPdfError } from "@sitelensapi/report-pdf";
const result = await exportReportPdf({
reportHtmlPath: "/path/to/report.html",
// outputPath defaults to sibling report.pdf
// serveRoot inferred for scenarios/ ↔ runs/ trees
});
// result.pdfPath, result.byteSize, result.browserBackend, result.warningsDesktop / website
- Desktop: call
exportReportPdffrom the local Node/Tauri side with filesystem paths; do not fork a second renderer. - Website / Dashboard: do not assume server-side Chromium. Prefer printing the portable HTML viewer (“Save as PDF” in the browser) or generate PDFs in CLI/MCP/CI where Chromium is installed.
Limitations
- Video prints as CSS fallback text (no frame scrubbing).
- Suite reports still do not flatten child screenshots — the suite PDF lists/links children only.
- Interactive filters/lightbox are disabled for print; disclosures are expanded before export.
- Critical gallery/comparison image load failures abort export by default.
CLI / MCP
Shipped via @sitelensapi/mcp:
sitelens report pdf --from ./report.html
sitelens report render --from ./run-dir --format html,pdfMCP tool: sitelens_report_export_pdf.
