dom-to-vector-pdf
Version:
Convert DOM elements to vector PDFs using jsPDF, dom-to-svg and svg2pdf.js
45 lines • 1.4 kB
TypeScript
import { jsPDF } from 'jspdf';
/**
* Export PDF配置项
*/
export interface ExportPdfOptions {
/** DOM element ID to export */
id: string;
/** Exported PDF file name */
filename: string;
/** PDF orientation, default is portrait */
orientation?: 'portrait' | 'landscape';
/** Unit, default is px */
unit?: 'pt' | 'px' | 'in' | 'mm' | 'cm' | 'ex' | 'em' | 'pc';
/** Custom hook for processing SVG elements */
beforeSvgConvert?: (svgElement: SVGElement) => void;
/** Custom hook for processing PDF document */
beforePdfSave?: (pdf: jsPDF) => void;
}
/**
* Font registration options
*/
export interface FontRegisterOptions {
/** Font file path or URL */
font: string;
/** Font ID for identifying the font */
fontId: string;
/** 字体样式 (normal/italic) */
fontStyle?: 'normal' | 'italic';
/** Font weight (100-900) */
fontWeight?: string | number;
}
/**
* Lifecycle hooks
*/
export interface LifecycleHooks {
/** Triggered after DOM clone */
afterDomClone?: (clonedElement: HTMLElement) => void;
/** Triggered before SVG conversion */
beforeSvgConvert?: (svgElement: SVGElement) => void;
/** Triggered before PDF generation */
beforePdfGenerate?: (pdf: jsPDF) => void;
/** Triggered before PDF save */
beforePdfSave?: (pdf: jsPDF) => void;
}
//# sourceMappingURL=types.d.ts.map