@pixldocs/canvas-renderer 0.3.28 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/index.cjs +1064 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +1064 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ import { SmartElementType } from '../../../shared/smart-elements/types';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function applyThemeToConfig(config: TemplateConfig, themeOverrides: ThemeVariables): TemplateConfig;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Assemble a vector PDF from SVG render results.
|
|
18
|
+
* This is the core function that converts canvas SVGs into a multi-page PDF document.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assemblePdfFromSvgs(svgResults: SvgRenderResult[], options?: PdfAssemblyOptions): Promise<PdfRenderResult>;
|
|
21
|
+
|
|
16
22
|
export declare interface CanvasNode {
|
|
17
23
|
id: string;
|
|
18
24
|
name?: string;
|
|
@@ -113,6 +119,41 @@ export declare interface PageSettings {
|
|
|
113
119
|
contentBottom?: number;
|
|
114
120
|
}
|
|
115
121
|
|
|
122
|
+
export declare interface PdfAssemblyOptions {
|
|
123
|
+
/** PDF document title */
|
|
124
|
+
title?: string;
|
|
125
|
+
/** Output filename hint */
|
|
126
|
+
filename?: string;
|
|
127
|
+
/** Whether to strip page background from SVG (drawn separately for gradient support) */
|
|
128
|
+
stripPageBackground?: boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Options for PDF rendering */
|
|
132
|
+
export declare interface PdfFromFormOptions {
|
|
133
|
+
templateId: string;
|
|
134
|
+
formSchemaId: string;
|
|
135
|
+
sectionState: SectionFormState;
|
|
136
|
+
themeId?: string;
|
|
137
|
+
/** Whether to inject watermark. Default: auto (true for paid templates, false for free). */
|
|
138
|
+
watermark?: boolean;
|
|
139
|
+
/** PDF document title */
|
|
140
|
+
title?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare interface PdfRenderResult {
|
|
144
|
+
/** PDF as a Blob */
|
|
145
|
+
blob: Blob;
|
|
146
|
+
/** PDF as ArrayBuffer */
|
|
147
|
+
arrayBuffer: ArrayBuffer;
|
|
148
|
+
/** Total number of pages */
|
|
149
|
+
totalPages: number;
|
|
150
|
+
/** Page dimensions (CSS pixels) */
|
|
151
|
+
pages: Array<{
|
|
152
|
+
width: number;
|
|
153
|
+
height: number;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
|
|
116
157
|
export declare function PixldocsPreview(props: PixldocsPreviewProps): JSX_2.Element;
|
|
117
158
|
|
|
118
159
|
declare interface PixldocsPreviewBaseProps {
|
|
@@ -198,8 +239,17 @@ export declare class PixldocsRenderer {
|
|
|
198
239
|
*/
|
|
199
240
|
renderSvgsFromForm(options: Omit<RenderFromFormOptions, 'format' | 'quality' | 'scale' | 'pixelRatio'>): Promise<SvgRenderResult[]>;
|
|
200
241
|
/**
|
|
201
|
-
*
|
|
242
|
+
* Render a pre-resolved template config to a vector PDF.
|
|
243
|
+
* Returns a Blob and ArrayBuffer.
|
|
244
|
+
*/
|
|
245
|
+
renderPdf(templateConfig: TemplateConfig, options?: {
|
|
246
|
+
title?: string;
|
|
247
|
+
}): Promise<PdfRenderResult>;
|
|
248
|
+
/**
|
|
249
|
+
* Resolve from V2 sectionState and render a vector PDF.
|
|
250
|
+
* This is the primary PDF export API — mirrors renderFromForm() but returns a PDF.
|
|
202
251
|
*/
|
|
252
|
+
renderPdfFromForm(options: PdfFromFormOptions): Promise<PdfRenderResult>;
|
|
203
253
|
renderById(templateId: string, formData?: Record<string, any>, options?: RenderOptions): Promise<RenderResult>;
|
|
204
254
|
/**
|
|
205
255
|
* Convenience: fetch by ID with flat data and render ALL pages.
|