Creates an html2pdf.js-compatible PDF chain.
Passing a source directly preserves html2pdf.js shorthand behavior and also
schedules save. Call without a source when composing an explicit chain.
Signature
export declare function html2pdf(source?: HtmlSource, options?: Html2PdfOptions): CompatWorker;Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source | HtmlSource | No | None | HTML string, mounted element, or ref-shaped value to render. |
options | Html2PdfOptions | No | None | Options for this operation. |
Returns
CompatWorkerExample
await html2pdf()
.set({ filename: "invoice.pdf", margin: [10, 12] })
.from(element)
.save();