import { renderToFile } from "@react-pdf/renderer"; import { createElement } from "react"; import { EstimationPDF } from "../components/EstimationPDF.js"; import { PRICING } from "../logic/pricing/constants.js"; import { calculateTotals } from "../logic/pricing/calculator.js"; export class PdfEngine { constructor() { } async generateEstimatePdf(state: any, outputPath: string): Promise { const totals = calculateTotals(state, PRICING); await renderToFile( createElement(EstimationPDF as any, { state, totalPrice: totals.totalPrice, pricing: PRICING, } as any) as any, outputPath ); return outputPath; } }