UNPKG

html-to-document-adapter-pdf

Version:

PDF adapter for html-to-document-core — converts a DocumentElement tree into .pdf using the html2pdf.js library.

21 lines 976 B
import { DocumentElement, IConverterDependencies, IDocumentConverter } from 'html-to-document-core'; export declare class PDFAdapter implements IDocumentConverter { private docxAdapter; private _defaultStyles; constructor(dependencies: IConverterDependencies); convert(elements: DocumentElement[]): Promise<Buffer | Blob>; private convertInNode; /** * Inserts a <div class="html2pdf__page-break"> before an <img> element only * when the image would overflow the remaining space on the current page. * * The calculation is intentionally approximate – we rely on declared height * attributes (falling back to a default) and assume a constant line height for * text nodes. This ensures images aren't blindly pushed to a new page while * avoiding complex layout calculations. */ private getImageHeight; private insertPageBreaks; private convertHtmlInBrowser; } //# sourceMappingURL=pdf.adapter.d.ts.map