@polotno/pdf-export 0.1.18 → 0.1.20
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 +52 -0
- package/lib/compare-render.d.ts +1 -0
- package/lib/compare-render.js +185 -0
- package/lib/figure.d.ts +10 -0
- package/lib/figure.js +53 -48
- package/lib/ghostscript.d.ts +21 -0
- package/lib/ghostscript.js +98 -128
- package/lib/group.d.ts +5 -0
- package/lib/group.js +4 -8
- package/lib/image.d.ts +21 -0
- package/lib/image.js +147 -89
- package/lib/index.d.ts +26 -0
- package/lib/index.js +133 -0
- package/lib/line.d.ts +10 -0
- package/lib/line.js +41 -57
- package/lib/spot-colors.d.ts +38 -0
- package/lib/spot-colors.js +141 -0
- package/lib/svg-render.d.ts +9 -0
- package/lib/svg-render.js +19 -28
- package/lib/svg.d.ts +11 -0
- package/lib/svg.js +212 -233
- package/lib/text.d.ts +39 -0
- package/lib/text.js +558 -165
- package/lib/utils.d.ts +16 -0
- package/lib/utils.js +118 -72
- package/package.json +35 -15
- package/index.js +0 -130
package/lib/text.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface TextElement {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
fontWeight?: string;
|
|
4
|
+
fontSize: number;
|
|
5
|
+
fontStyle?: string;
|
|
6
|
+
fill: string;
|
|
7
|
+
opacity: number;
|
|
8
|
+
strokeWidth: number;
|
|
9
|
+
stroke?: string;
|
|
10
|
+
align: string;
|
|
11
|
+
textDecoration: string;
|
|
12
|
+
letterSpacing?: number;
|
|
13
|
+
lineHeight: number;
|
|
14
|
+
text: string;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
verticalAlign?: string;
|
|
18
|
+
backgroundEnabled?: boolean;
|
|
19
|
+
backgroundPadding?: number;
|
|
20
|
+
backgroundCornerRadius?: number;
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RenderAttrs {
|
|
24
|
+
pdfx1a?: boolean;
|
|
25
|
+
textVerticalResizeEnabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TextSegment {
|
|
28
|
+
text: string;
|
|
29
|
+
bold?: boolean;
|
|
30
|
+
italic?: boolean;
|
|
31
|
+
underline?: boolean;
|
|
32
|
+
color?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function getGoogleFontPath(fontFamily: string, fontWeight?: string, italic?: boolean): Promise<string>;
|
|
35
|
+
export declare function loadFontIfNeeded(doc: any, element: TextElement, fonts: Record<string, boolean>): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Main text rendering function
|
|
38
|
+
*/
|
|
39
|
+
export declare function renderText(doc: PDFKit.PDFDocument, element: TextElement, fonts: Record<string, boolean>, attrs?: RenderAttrs): Promise<void>;
|