pols-pdf 1.1.0 → 1.1.2
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/dist/index.d.ts +1 -91
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,24 +4,12 @@ export type PBoundParams = number | {
|
|
|
4
4
|
left?: number;
|
|
5
5
|
right?: number;
|
|
6
6
|
};
|
|
7
|
-
export type PBound = {
|
|
8
|
-
top: number;
|
|
9
|
-
bottom: number;
|
|
10
|
-
left: number;
|
|
11
|
-
right: number;
|
|
12
|
-
};
|
|
13
7
|
export type PRadiusParams = number | {
|
|
14
8
|
leftTop?: number;
|
|
15
9
|
rightTop?: number;
|
|
16
10
|
rightBottom?: number;
|
|
17
11
|
leftBottom?: number;
|
|
18
12
|
};
|
|
19
|
-
export type PRadius = {
|
|
20
|
-
leftTop: number;
|
|
21
|
-
rightTop: number;
|
|
22
|
-
rightBottom: number;
|
|
23
|
-
leftBottom: number;
|
|
24
|
-
};
|
|
25
13
|
export type PBorderParams = boolean | {
|
|
26
14
|
leftTop?: boolean;
|
|
27
15
|
top?: boolean;
|
|
@@ -32,16 +20,6 @@ export type PBorderParams = boolean | {
|
|
|
32
20
|
leftBottom?: boolean;
|
|
33
21
|
left?: boolean;
|
|
34
22
|
};
|
|
35
|
-
export type PBorder = {
|
|
36
|
-
leftTop: boolean;
|
|
37
|
-
top: boolean;
|
|
38
|
-
rightTop: boolean;
|
|
39
|
-
right: boolean;
|
|
40
|
-
rightBottom: boolean;
|
|
41
|
-
bottom: boolean;
|
|
42
|
-
leftBottom: boolean;
|
|
43
|
-
left: boolean;
|
|
44
|
-
};
|
|
45
23
|
export type PBorderColorParams = string | {
|
|
46
24
|
top?: string;
|
|
47
25
|
rightTop?: string;
|
|
@@ -52,16 +30,6 @@ export type PBorderColorParams = string | {
|
|
|
52
30
|
left?: string;
|
|
53
31
|
leftTop?: string;
|
|
54
32
|
};
|
|
55
|
-
export type PBorderColor = {
|
|
56
|
-
top: string;
|
|
57
|
-
rightTop: string;
|
|
58
|
-
right: string;
|
|
59
|
-
rightBottom: string;
|
|
60
|
-
bottom: string;
|
|
61
|
-
leftBottom: string;
|
|
62
|
-
left: string;
|
|
63
|
-
leftTop: string;
|
|
64
|
-
};
|
|
65
33
|
export type PPage = {
|
|
66
34
|
size: 'A4' | 'LETTER';
|
|
67
35
|
layout: 'portrait' | 'landscape';
|
|
@@ -119,31 +87,6 @@ export type PTextParams = {
|
|
|
119
87
|
chars: string;
|
|
120
88
|
font?: Partial<PFontParams>;
|
|
121
89
|
};
|
|
122
|
-
type PLetter = {
|
|
123
|
-
char: string;
|
|
124
|
-
left: number;
|
|
125
|
-
top: number;
|
|
126
|
-
width: number;
|
|
127
|
-
height: number;
|
|
128
|
-
font: PFont;
|
|
129
|
-
};
|
|
130
|
-
export type PCell = {
|
|
131
|
-
letters: PLetter[];
|
|
132
|
-
left: number;
|
|
133
|
-
top: number;
|
|
134
|
-
height: number;
|
|
135
|
-
width: number;
|
|
136
|
-
padding: PBound;
|
|
137
|
-
border: PBorder;
|
|
138
|
-
radius: PRadius;
|
|
139
|
-
stroke?: {
|
|
140
|
-
width?: number;
|
|
141
|
-
color?: PBorderColorParams;
|
|
142
|
-
};
|
|
143
|
-
fillColor?: string;
|
|
144
|
-
hAlign?: 'left' | 'center' | 'right';
|
|
145
|
-
vAlign?: 'top' | 'center' | 'bottom';
|
|
146
|
-
};
|
|
147
90
|
export type PCellParams = {
|
|
148
91
|
text: null | undefined | number | string | PTextParams | PTextParams[];
|
|
149
92
|
left?: number;
|
|
@@ -165,24 +108,8 @@ export type PCellParams = {
|
|
|
165
108
|
} & ({
|
|
166
109
|
height: number;
|
|
167
110
|
} | {
|
|
168
|
-
autojump
|
|
111
|
+
autojump?: boolean;
|
|
169
112
|
});
|
|
170
|
-
export type PRow = {
|
|
171
|
-
cells: Omit<PCell, 'autojump'>[];
|
|
172
|
-
gap?: number;
|
|
173
|
-
left: number;
|
|
174
|
-
top: number;
|
|
175
|
-
width: number;
|
|
176
|
-
height: number;
|
|
177
|
-
padding: PBound;
|
|
178
|
-
border: PBorder;
|
|
179
|
-
radius: PRadius;
|
|
180
|
-
stroke?: {
|
|
181
|
-
width?: number;
|
|
182
|
-
color?: PBorderColorParams;
|
|
183
|
-
};
|
|
184
|
-
fillColor?: string;
|
|
185
|
-
};
|
|
186
113
|
export type PRowParams = {
|
|
187
114
|
cells: (Omit<PCellParams, 'width' | 'left' | 'top' | 'height' | 'autojump'> & ({
|
|
188
115
|
width: number;
|
|
@@ -222,22 +149,6 @@ export type PTableParams = {
|
|
|
222
149
|
width?: 'full' | 'auto' | number;
|
|
223
150
|
autojump?: boolean;
|
|
224
151
|
};
|
|
225
|
-
export type PTable = {
|
|
226
|
-
rows: PRow[];
|
|
227
|
-
gap?: number;
|
|
228
|
-
left: number;
|
|
229
|
-
top: number;
|
|
230
|
-
width: number;
|
|
231
|
-
height: number;
|
|
232
|
-
padding: PBound;
|
|
233
|
-
border: PBorder;
|
|
234
|
-
radius: PRadius;
|
|
235
|
-
stroke?: {
|
|
236
|
-
width?: number;
|
|
237
|
-
color?: PBorderColorParams;
|
|
238
|
-
};
|
|
239
|
-
fillColor?: string;
|
|
240
|
-
};
|
|
241
152
|
export declare class PPdf {
|
|
242
153
|
private static readonly charWidthCache;
|
|
243
154
|
private static readonly lineHeightCache;
|
|
@@ -290,5 +201,4 @@ export declare class PPdf {
|
|
|
290
201
|
private prepareBorderValues;
|
|
291
202
|
private prepareBorderColorValues;
|
|
292
203
|
}
|
|
293
|
-
export {};
|
|
294
204
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -204,8 +204,8 @@ class PPdf {
|
|
|
204
204
|
left: left + padding.left,
|
|
205
205
|
top: cursorTop,
|
|
206
206
|
width: usefulWidth,
|
|
207
|
-
font: params.font,
|
|
208
|
-
autojump:
|
|
207
|
+
font: { ...params.font, ...rowToDraw.font },
|
|
208
|
+
autojump: params.autojump ?? true
|
|
209
209
|
});
|
|
210
210
|
if (preparedRow.currentPage.cells.some(cell => cell.letters?.length)) {
|
|
211
211
|
buffer.rows.push(preparedRow.currentPage);
|
|
@@ -304,8 +304,8 @@ class PPdf {
|
|
|
304
304
|
left: cursorLeft,
|
|
305
305
|
top: top + padding.top,
|
|
306
306
|
width: cellWidth,
|
|
307
|
-
font:
|
|
308
|
-
autojump:
|
|
307
|
+
font: { ...params.font, ...cell.font },
|
|
308
|
+
autojump: params.autojump ?? true,
|
|
309
309
|
complete: params.complete
|
|
310
310
|
});
|
|
311
311
|
response.currentPage.cells.push(preparedCell.currentPage);
|
|
@@ -578,7 +578,7 @@ class PPdf {
|
|
|
578
578
|
if (!firstLetterOfLine)
|
|
579
579
|
continue;
|
|
580
580
|
/* Si la letra se desborda, se crea un nuevo párrafo */
|
|
581
|
-
if ('
|
|
581
|
+
if (!('height' in params) && (params.autojump ?? true) && currentParagraph != 'nextPage' && firstLetterOfLine.top + firstLetterOfLine.height + padding.bottom > (this.engine.page.height - this.engine.page.margins.bottom)) {
|
|
582
582
|
if (params.complete) {
|
|
583
583
|
paragraphs.nextPage = paragraphs.currentPage;
|
|
584
584
|
paragraphs.currentPage = [];
|