@shad0wz7/nestjs-pdf 2.4.2 → 2.5.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/dist/index.d.mts CHANGED
@@ -1,384 +1,520 @@
1
- import { OnModuleDestroy, DynamicModule, ModuleMetadata, OnModuleInit, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
2
- import { HandlebarsOptions } from '@gboutte/nestjs-hbs/dist/handlebars-options.interface';
3
- import * as _puppeteer_browsers from '@puppeteer/browsers';
4
- import { Browser as Browser$1 } from '@puppeteer/browsers';
5
- import { Browser, BrowserContext, PDFOptions } from 'puppeteer';
6
- import { MJMLParsingOptions } from 'mjml-core';
7
- import { Options, LocalsObject } from 'pug';
8
- import { Options as Options$1, Data } from 'ejs';
9
- import { ConfigureOptions } from 'nunjucks';
10
- import { EtaConfig } from 'eta';
11
- import { EscapeFunction } from 'mustache';
12
- import { HandlebarsService } from '@gboutte/nestjs-hbs';
13
-
1
+ import { DynamicModule, InjectionToken, ModuleMetadata, OnModuleDestroy, OnModuleInit, OptionalFactoryDependency } from "@nestjs/common";
2
+ import { Browser, BrowserContext, PDFOptions } from "puppeteer";
3
+ import { Browser as Browser$1 } from "@puppeteer/browsers";
4
+ import { HandlebarsService } from "@gboutte/nestjs-hbs";
5
+ import { LocalsObject, Options } from "pug";
6
+ import { Data, Options as Options$1 } from "ejs";
7
+ import { ConfigureOptions } from "nunjucks";
8
+ import { EtaConfig } from "eta";
9
+ import { EscapeFunction } from "mustache";
10
+ import { HandlebarsOptions } from "@gboutte/nestjs-hbs/dist/handlebars-options.interface";
11
+ //#region src/puppeteer/browser/browser.service.d.ts
14
12
  declare enum BrowserTag {
15
- LATEST = "latest",
16
- BETA = "beta",
17
- DEV = "dev",
18
- STABLE = "stable",
19
- CANARY = "canary"
13
+ LATEST = "latest",
14
+ BETA = "beta",
15
+ DEV = "dev",
16
+ STABLE = "stable",
17
+ CANARY = "canary"
20
18
  }
19
+ type Headless = boolean | 'shell' | undefined;
21
20
  declare class BrowserService implements OnModuleDestroy {
22
- private readonly cacheDir;
23
- private readonly options?;
24
- private _browserInstance;
25
- private browser;
26
- activeJobs: number;
27
- totalJobs: number;
28
- private recycleRequested;
29
- private recycling;
30
- private browserTag;
31
- private useLockedBrowser;
32
- private buildId;
33
- constructor(pdfParams: PuppeteerParameters);
34
- onModuleDestroy(): Promise<void>;
35
- getBrowserInstance(args: string[], headless: boolean | 'shell' | undefined, executablePathBin: string | undefined): Promise<Browser>;
36
- createContext(args: string[], headless: boolean | 'shell' | undefined, executablePath?: string): Promise<BrowserContext>;
37
- markJobStarted(): void;
38
- markJobFinished(): Promise<void>;
39
- recycleBrowserIfNeeded(): Promise<void>;
40
- private cleanupCacheBestEffort;
41
- install(lock?: boolean): Promise<_puppeteer_browsers.InstalledBrowser | null | undefined>;
42
- private registerCleanupHooks;
43
- private loadBrowser;
44
- setBrowser(browser: Browser$1): void;
45
- getBrowser(): Browser$1;
46
- private loadBrowserTag;
47
- private loadBuildId;
48
- setBrowserTag(browserTag: BrowserTag): void;
49
- getBrowserTag(): BrowserTag;
50
- getBuildId(): string | undefined;
51
- setBuildId(value: string | undefined): void;
52
- private loadUseLockedBrowser;
53
- hasBrowserInstalled(browser: Browser$1, buildId: string): Promise<boolean>;
54
- getExecutablePath(): Promise<string>;
55
- private writeLockFile;
56
- getLockedBuildId(browser: Browser$1): string | null;
21
+ private readonly cacheDir;
22
+ private readonly options?;
23
+ private _browserInstance;
24
+ private browser;
25
+ activeJobs: number;
26
+ totalJobs: number;
27
+ private recycleRequested;
28
+ private recycling;
29
+ private browserTag;
30
+ private useLockedBrowser;
31
+ private buildId;
32
+ constructor(pdfParams: PuppeteerParameters);
33
+ onModuleDestroy(): Promise<void>;
34
+ getBrowserInstance(args: string[], headless: boolean | 'shell' | undefined, executablePathBin: string | undefined): Promise<Browser>;
35
+ createContext(args: string[], headless: Headless, executablePath?: string): Promise<BrowserContext>;
36
+ markJobStarted(): void;
37
+ markJobFinished(): Promise<void>;
38
+ recycleBrowserIfNeeded(): Promise<void>;
39
+ private cleanupCacheBestEffort;
40
+ install(lock?: boolean): Promise<import("@puppeteer/browsers", { with: { "resolution-mode": "import" } }).InstalledBrowser | null | undefined>;
41
+ private registerCleanupHooks;
42
+ private loadBrowser;
43
+ setBrowser(browser: Browser$1): void;
44
+ getBrowser(): Browser$1;
45
+ private loadBrowserTag;
46
+ private loadBuildId;
47
+ setBrowserTag(browserTag: BrowserTag): void;
48
+ getBrowserTag(): BrowserTag;
49
+ getBuildId(): string | undefined;
50
+ setBuildId(value: string | undefined): void;
51
+ private loadUseLockedBrowser;
52
+ hasBrowserInstalled(browser: Browser$1, buildId: string): Promise<boolean>;
53
+ getExecutablePath(): Promise<string>;
54
+ private launchBrowser;
55
+ private writeLockFile;
56
+ getLockedBuildId(browser: Browser$1): string | null;
57
57
  }
58
-
58
+ //#endregion
59
+ //#region node_modules/.pnpm/@types+mjml-core@5.1.0/node_modules/@types/mjml-core/index.d.ts
60
+ /**
61
+ * Options passed as an object to the mjml2html function
62
+ *
63
+ * https://documentation.mjml.io/#inside-node-js
64
+ */
65
+ interface MJMLParsingOptions {
66
+ /**
67
+ * Default fonts imported in the HTML rendered by HTML
68
+ * ie. { 'Open Sans': 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700' }
69
+ *
70
+ * default: @see https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js
71
+ */
72
+ fonts?: {
73
+ [key: string]: string;
74
+ } | undefined;
75
+ /**
76
+ * Option to keep comments in the HTML output
77
+ * default: true
78
+ */
79
+ keepComments?: boolean | undefined;
80
+ /**
81
+ * Beautify the HTML output using prettier (parser: 'html', printWidth: 240).
82
+ * Mutually exclusive with minify — if minify is true, beautify is skipped.
83
+ * Note: the CLI defaults this to true; the programmatic API defaults to false.
84
+ * default: false
85
+ */
86
+ beautify?: boolean | undefined;
87
+ /**
88
+ * Minify the HTML output using htmlnano (with cssnano-preset-lite for CSS).
89
+ * Takes priority over beautify when both are true.
90
+ * default: false
91
+ */
92
+ minify?: boolean | undefined;
93
+ /**
94
+ * Options passed to htmlnano when minify is true.
95
+ * The minifyCss field accepts false, true, 'lite', or a cssnano options object.
96
+ * All htmlnano v3 options are accepted.
97
+ */
98
+ minifyOptions?: MJMLMinifyOptions | undefined;
99
+ /**
100
+ * How to validate your MJML
101
+ *
102
+ * skip: your document is rendered without going through validation
103
+ * soft: your document is going through validation and is rendered, even if it has errors
104
+ * strict: your document is going through validation and is not rendered if it has any error
105
+ *
106
+ * default: soft
107
+ */
108
+ validationLevel?: "strict" | "soft" | "skip" | undefined;
109
+ /**
110
+ * Full path of the specified file to use when resolving paths from mj-include components
111
+ * default: '.'
112
+ */
113
+ filePath?: string | undefined;
114
+ /**
115
+ * Directory (or directories) outside the template's own folder from which mj-include
116
+ * partials may be loaded. Added in mjml 5.1 as part of the include path-traversal hardening;
117
+ * includes resolving outside these allowed roots are denied.
118
+ */
119
+ includePath?: string | string[] | undefined;
120
+ /**
121
+ * The path or directory of the .mjmlconfig file
122
+ * default: process.cwd()
123
+ */
124
+ mjmlConfigPath?: string | undefined;
125
+ /**
126
+ * Use the config attribute defined in the .mjmlconfig file.
127
+ * The config passed into mjml2html overrides the .mjmlconfig.
128
+ * default: false
129
+ */
130
+ useMjmlConfigOptions?: boolean | undefined;
131
+ /**
132
+ * optional setting when inlining css, see mjml-cli documentation for more info
133
+ */
134
+ juicePreserveTags?: {
135
+ [index: string]: {
136
+ start: string;
137
+ end: string;
138
+ };
139
+ } | undefined;
140
+ juiceOptions?: any;
141
+ /**
142
+ * undocumented
143
+ * a function returning html skeleton
144
+ * default: see mjml-core/src/helpers/skeleton.js
145
+ */
146
+ skeleton?: string | (() => string) | undefined;
147
+ actualPath?: string | undefined;
148
+ /**
149
+ * undocumented
150
+ * ignore mj-include elements
151
+ * default: false
152
+ */
153
+ ignoreIncludes?: any;
154
+ /**
155
+ * see mjml-parser-xml
156
+ */
157
+ preprocessors?: Array<((xml: string) => string)> | undefined;
158
+ /**
159
+ * Add media queries specific to printer when converting mjml into html. When enabling this option,
160
+ * the html might not be compatible with all email clients anymore.
161
+ */
162
+ printerSupport?: boolean | undefined;
163
+ }
164
+ interface MJMLMinifyOptions {
165
+ collapseWhitespace?: boolean | undefined;
166
+ /**
167
+ * CSS minification options passed to cssnano-preset-lite.
168
+ * Accepts false (disable), true/'lite' (use lite preset), or a cssnano options object.
169
+ * @see https://cssnano.co/docs/presets
170
+ */
171
+ minifyCss?: boolean | "lite" | {
172
+ preset?: any;
173
+ plugins?: any[];
174
+ configFile?: string;
175
+ } | undefined;
176
+ /** @deprecated use minifyCss instead */
177
+ minifyCSS?: boolean | undefined;
178
+ removeEmptyAttributes?: boolean | undefined;
179
+ minifyJs?: boolean | undefined;
180
+ removeComments?: false | "safe" | "all" | undefined;
181
+ }
182
+ //#endregion
183
+ //#region src/puppeteer/engines/pug/pug.service.d.ts
59
184
  type PugOptions = Options;
60
185
  declare class PugService {
61
- render(template: string, data?: LocalsObject, options?: PugOptions): string;
62
- renderFile(filePath: string, data?: LocalsObject, options?: PugOptions): string;
186
+ render(template: string, data?: LocalsObject, options?: PugOptions): string;
187
+ renderFile(filePath: string, data?: LocalsObject, options?: PugOptions): string;
63
188
  }
64
-
189
+ //#endregion
190
+ //#region src/puppeteer/engines/ejs/ejs.service.d.ts
65
191
  interface EjsOptions extends Omit<Options$1, 'async'> {
66
- async?: boolean;
192
+ async?: boolean;
67
193
  }
68
194
  declare class EjsService {
69
- render(template: string, data?: Data, options?: EjsOptions): Promise<string>;
70
- renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
195
+ render(template: string, data?: Data, options?: EjsOptions): Promise<string>;
196
+ renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
71
197
  }
72
-
198
+ //#endregion
199
+ //#region src/puppeteer/engines/nunjucks/nunjucks.service.d.ts
73
200
  interface NunjucksOptions extends Partial<ConfigureOptions> {
74
- noCache?: boolean;
75
- watch?: boolean;
76
- throwOnUndefined?: boolean;
77
- trimBlocks?: boolean;
78
- lstripBlocks?: boolean;
201
+ noCache?: boolean;
202
+ watch?: boolean;
203
+ throwOnUndefined?: boolean;
204
+ trimBlocks?: boolean;
205
+ lstripBlocks?: boolean;
79
206
  }
80
207
  declare class NunjucksService {
81
- constructor();
82
- render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
83
- renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
208
+ constructor();
209
+ render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
210
+ renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
84
211
  }
85
-
212
+ //#endregion
213
+ //#region src/puppeteer/engines/eta/eta.service.d.ts
86
214
  interface EtaOptions extends Partial<EtaConfig> {
87
- cache?: boolean;
88
- autoEscape?: boolean;
89
- varName?: string;
90
- views?: string;
91
- useWith?: boolean;
92
- plugins?: any[];
215
+ cache?: boolean;
216
+ autoEscape?: boolean;
217
+ varName?: string;
218
+ views?: string;
219
+ useWith?: boolean;
220
+ plugins?: any[];
93
221
  }
94
222
  declare class EtaService {
95
- private eta;
96
- private readonly templateCache;
97
- private readonly maxCacheSize;
98
- constructor();
99
- /**
100
- * Render an Eta template from a string
101
- * @param template The template string to render
102
- * @param data The data object to use for rendering
103
- * @param options Optional Eta rendering options
104
- * @returns The rendered HTML string
105
- */
106
- render(template: string, data?: Record<string, unknown>, options?: EtaOptions): string;
107
- /**
108
- * Render an Eta template from a file
109
- * @param filePath The path to the template file
110
- * @param data The data object to use for rendering
111
- * @param options Optional Eta rendering options
112
- * @returns The rendered HTML string
113
- */
114
- renderFile(filePath: string, data?: Record<string, unknown>, options?: EtaOptions): string;
115
- /**
116
- * Clear the template cache
117
- */
118
- clearCache(): void;
119
- /**
120
- * Get the current cache size
121
- * @returns The number of cached templates
122
- */
123
- getCacheSize(): number;
223
+ private readonly eta;
224
+ private readonly templateCache;
225
+ private readonly maxCacheSize;
226
+ constructor();
227
+ /**
228
+ * Render an Eta template from a string
229
+ * @param template The template string to render
230
+ * @param data The data object to use for rendering
231
+ * @param options Optional Eta rendering options
232
+ * @returns The rendered HTML string
233
+ */
234
+ render(template: string, data?: Record<string, unknown>, options?: EtaOptions): string;
235
+ /**
236
+ * Render an Eta template from a file
237
+ * @param filePath The path to the template file
238
+ * @param data The data object to use for rendering
239
+ * @param options Optional Eta rendering options
240
+ * @returns The rendered HTML string
241
+ */
242
+ renderFile(filePath: string, data?: Record<string, unknown>, options?: EtaOptions): string;
243
+ /**
244
+ * Clear the template cache
245
+ */
246
+ clearCache(): void;
247
+ /**
248
+ * Get the current cache size
249
+ * @returns The number of cached templates
250
+ */
251
+ getCacheSize(): number;
124
252
  }
125
-
253
+ //#endregion
254
+ //#region src/puppeteer/engines/mustache/mustache.service.d.ts
126
255
  interface MustacheOptions {
127
- tags?: [string, string];
128
- escape?: EscapeFunction;
256
+ tags?: [string, string];
257
+ escape?: EscapeFunction;
129
258
  }
130
259
  declare class MustacheService {
131
- private readonly templateCache;
132
- private readonly maxCacheSize;
133
- /**
134
- * Render a Mustache template from a string
135
- * @param template The template string to render
136
- * @param data The data object to use for rendering
137
- * @param options Optional Mustache rendering options
138
- * @returns The rendered HTML string
139
- */
140
- render(template: string, data?: Record<string, unknown>, options?: MustacheOptions): string;
141
- /**
142
- * Render a Mustache template from a file
143
- * @param filePath The path to the template file
144
- * @param data The data object to use for rendering
145
- * @param options Optional Mustache rendering options
146
- * @returns The rendered HTML string
147
- */
148
- renderFile(filePath: string, data?: Record<string, unknown>, options?: MustacheOptions): string;
149
- /**
150
- * Clear the template cache
151
- */
152
- clearCache(): void;
153
- /**
154
- * Get the current cache size
155
- * @returns The number of cached templates
156
- */
157
- getCacheSize(): number;
260
+ private readonly templateCache;
261
+ private readonly maxCacheSize;
262
+ /**
263
+ * Render a Mustache template from a string
264
+ * @param template The template string to render
265
+ * @param data The data object to use for rendering
266
+ * @param options Optional Mustache rendering options
267
+ * @returns The rendered HTML string
268
+ */
269
+ render(template: string, data?: Record<string, unknown>, options?: MustacheOptions): string;
270
+ /**
271
+ * Render a Mustache template from a file
272
+ * @param filePath The path to the template file
273
+ * @param data The data object to use for rendering
274
+ * @param options Optional Mustache rendering options
275
+ * @returns The rendered HTML string
276
+ */
277
+ renderFile(filePath: string, data?: Record<string, unknown>, options?: MustacheOptions): string;
278
+ /**
279
+ * Clear the template cache
280
+ */
281
+ clearCache(): void;
282
+ /**
283
+ * Get the current cache size
284
+ * @returns The number of cached templates
285
+ */
286
+ getCacheSize(): number;
158
287
  }
159
-
288
+ //#endregion
289
+ //#region src/puppeteer/puppeteer-parameters.interface.d.ts
160
290
  interface PuppeteerParameters {
161
- pdfOptions?: PDFOptions;
162
- hbsOptions?: HandlebarsOptions;
163
- mjmlOptions?: MJMLParsingOptions;
164
- pugOptions?: PugOptions;
165
- ejsOptions?: EjsOptions;
166
- nunjucksOptions?: NunjucksOptions;
167
- etaOptions?: EtaOptions;
168
- mustacheOptions?: MustacheOptions;
169
- chromiumRevision?: string;
170
- buildId?: string;
171
- headless?: boolean | 'shell';
172
- browser?: Browser$1;
173
- browserTag?: BrowserTag;
174
- useLockedBrowser?: boolean;
175
- browserInstallBaseUrl?: string;
176
- extraPuppeteerArgs?: string[];
177
- executablePath?: string;
178
- cleanupBrowserCacheOnExit?: boolean;
291
+ pdfOptions?: PDFOptions;
292
+ hbsOptions?: HandlebarsOptions;
293
+ mjmlOptions?: MJMLParsingOptions;
294
+ pugOptions?: PugOptions;
295
+ ejsOptions?: EjsOptions;
296
+ nunjucksOptions?: NunjucksOptions;
297
+ etaOptions?: EtaOptions;
298
+ mustacheOptions?: MustacheOptions;
299
+ chromiumRevision?: string;
300
+ buildId?: string;
301
+ headless?: boolean | 'shell';
302
+ browser?: Browser$1;
303
+ browserTag?: BrowserTag;
304
+ useLockedBrowser?: boolean;
305
+ browserInstallBaseUrl?: string;
306
+ extraPuppeteerArgs?: string[];
307
+ executablePath?: string;
308
+ cleanupBrowserCacheOnExit?: boolean;
179
309
  }
180
-
310
+ //#endregion
311
+ //#region src/nestjs-pdf.module.d.ts
181
312
  interface PdfLibModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
182
- inject?: any[];
183
- useFactory: (...args: any[]) => any;
313
+ inject?: any[];
314
+ useFactory: (...args: any[]) => any;
184
315
  }
185
316
  declare class NestjsPdfModule {
186
- static forRoot(options: PuppeteerParameters): DynamicModule;
187
- static forRootAsync(options: PdfLibModuleAsyncOptions): DynamicModule;
317
+ static forRoot(options: PuppeteerParameters): DynamicModule;
318
+ static forRootAsync(options: PdfLibModuleAsyncOptions): DynamicModule;
188
319
  }
189
-
320
+ //#endregion
321
+ //#region src/puppeteer/engines/mjml/mjml.service.d.ts
190
322
  declare class MjmlService {
191
- render(template: string, options?: MJMLParsingOptions): Promise<string>;
192
- renderFile(filePath: string, options?: MJMLParsingOptions): Promise<string>;
323
+ render(template: string, options?: MJMLParsingOptions): Promise<string>;
324
+ renderFile(filePath: string, options?: MJMLParsingOptions): Promise<string>;
193
325
  }
194
-
326
+ //#endregion
327
+ //#region src/puppeteer/puppeteer.service.d.ts
195
328
  declare class PuppeteerService {
196
- private readonly hbsService;
197
- private readonly browserService;
198
- private readonly options;
199
- private readonly mjmlService?;
200
- private readonly pugService?;
201
- private readonly ejsService?;
202
- private readonly nunjucksService?;
203
- private readonly etaService?;
204
- private readonly mustacheService?;
205
- constructor(hbsService: HandlebarsService, browserService: BrowserService, options: PuppeteerParameters, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined, nunjucksService?: NunjucksService | undefined, etaService?: EtaService | undefined, mustacheService?: MustacheService | undefined);
206
- private readonly limit;
207
- generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
208
- generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
209
- generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
210
- generatePdfFromMjmlString(template: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
211
- generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
212
- generatePdfFromPugString(template: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
213
- generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
214
- generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
215
- generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
216
- generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
217
- generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
218
- generatePdfFromEtaString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
219
- generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
220
- generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
221
- generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
329
+ private readonly browserService;
330
+ private readonly options;
331
+ private readonly hbsService?;
332
+ private readonly mjmlService?;
333
+ private readonly pugService?;
334
+ private readonly ejsService?;
335
+ private readonly nunjucksService?;
336
+ private readonly etaService?;
337
+ private readonly mustacheService?;
338
+ constructor(browserService: BrowserService, options: PuppeteerParameters, hbsService?: HandlebarsService | undefined, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined, nunjucksService?: NunjucksService | undefined, etaService?: EtaService | undefined, mustacheService?: MustacheService | undefined);
339
+ private readonly limit;
340
+ generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
341
+ generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
342
+ generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
343
+ generatePdfFromMjmlString(template: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
344
+ generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
345
+ generatePdfFromPugString(template: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
346
+ generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
347
+ generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
348
+ generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
349
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
350
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
351
+ generatePdfFromEtaString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
352
+ generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
353
+ generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
354
+ generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
222
355
  }
223
-
356
+ //#endregion
357
+ //#region src/nestjs-pdf.service.d.ts
224
358
  declare class NestjsPdfService {
225
- private readonly puppeteerService;
226
- constructor(puppeteerService: PuppeteerService);
227
- /**
228
- * @param html HTML string to convert to PDF
229
- * @param options PDF generation options (optional)
230
- * @returns PDF generated from the provided HTML
231
- * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
232
- */
233
- generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
234
- /**
235
- * @param template Handlebars template string
236
- * @param parameters Data parameters to inject into the template
237
- * @param options PDF generation options (optional)
238
- * @returns PDF generated from the provided Handlebars template with parameters applied
239
- * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
240
- */
241
- generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
242
- /**
243
- * @param file Path to the Handlebars template file
244
- * @param parameters Data parameters to inject into the template
245
- * @param options PDF generation options (optional)
246
- * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
247
- * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
248
- */
249
- generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
250
- /**
251
- * @param template MJML template string
252
- * @param options PDF generation options (optional)
253
- * @returns PDF generated from the provided MJML template
254
- * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
255
- */
256
- generatePdfFromMjmlString(template: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
257
- /**
258
- * @param file Path to the MJML template file
259
- * @param options PDF generation options (optional)
260
- * @returns PDF generated from the MJML template at the provided file path
261
- * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
262
- */
263
- generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
264
- /**
265
- * @param template EJS template string
266
- * @param data Data to inject into the template
267
- * @param options PDF generation options (optional)
268
- * @returns PDF generated from the provided EJS template with data applied
269
- * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
270
- */
271
- generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
272
- /**
273
- * @param file Path to the EJS template file
274
- * @param data Data to inject into the template
275
- * @param options PDF generation options (optional)
276
- * @returns PDF generated from the EJS template at the provided file path with data applied
277
- * @description This method generates a PDF from an EJS template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
278
- */
279
- generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
280
- /**
281
- * @param template Pug template string
282
- * @param data Data to inject into the template
283
- * @param options PDF generation options (optional)
284
- * @returns PDF generated from the provided Pug template with data applied
285
- * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
286
- */
287
- generatePdfFromPugString(template: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
288
- /**
289
- * @param file Path to the Pug template file
290
- * @param data Data to inject into the template
291
- * @param options PDF generation options (optional)
292
- * @returns PDF generated from the Pug template at the provided file path with data applied
293
- * @description This method generates a PDF from a Pug template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
294
- */
295
- generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
296
- /**
297
- * @param template Nunjucks template string
298
- * @param data Data to inject into the template
299
- * @param options PDF generation options (optional)
300
- * @returns PDF generated from the provided Nunjucks template with data applied
301
- * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
302
- */
303
- generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
304
- /**
305
- * @param file Path to the Nunjucks template file
306
- * @param data Data to inject into the template
307
- * @param options PDF generation options (optional)
308
- * @returns PDF generated from the Nunjucks template at the provided file path with data applied
309
- * @description This method generates a PDF from a Nunjucks template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
310
- */
311
- generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
312
- /**
313
- * @param template Eta template string
314
- * @param data Data to inject into the template
315
- * @param options PDF generation options (optional)
316
- * @returns PDF generated from the provided Eta template with data applied
317
- * @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
318
- */
319
- generatePdfFromEtaString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
320
- /**
321
- * @param file Path to the Eta template file
322
- * @param data Data to inject into the template
323
- * @param options PDF generation options (optional)
324
- * @returns PDF generated from the Eta template at the provided file path with data applied
325
- * @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
326
- */
327
- generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
328
- /**
329
- * @param template Mustache template string
330
- * @param data Data to inject into the template
331
- * @param options PDF generation options (optional)
332
- * @returns PDF generated from the provided Mustache template with data applied
333
- * @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
334
- */
335
- generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
336
- /**
337
- * @param file Path to the Mustache template file
338
- * @param data Data to inject into the template
339
- * @param options PDF generation options (optional)
340
- * @returns PDF generated from the Mustache template at the provided file path with data applied
341
- * @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
342
- */
343
- generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
344
- /**
345
- * @param pdf The PDF bytes to modify
346
- * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
347
- * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
348
- * @returns Modified PDF with a signature field added at the anchor position
349
- * @description This method adds a signature field to a PDF using a text anchor as a reference for the field position. It uses the `addSignatureFieldUsingAnchor` function which finds the anchor in the PDF and inserts a signature field at that location. The signature field is named according to the `fieldName` parameter and the anchor is defined by `anchorText`.
350
- *
351
- * Usage example:
352
- * ```typescript
353
- * const modifiedPdf = await pdfService.addSignatureFieldSignatureDebtorRaw(
354
- * originalPdfBytes,
355
- * 'SignatureDebtor',
356
- * '__SIG_DEBTOR_ANCHOR__'
357
- * );
358
- * ```
359
- *
360
- * In this example, `originalPdfBytes` is a byte array representing the original PDF, `SignatureDebtor` is the name of the signature field to add, and `__SIG_DEBTOR_ANCHOR__` is the anchor text used to position the signature field in the PDF.
361
- *
362
- * If the anchor is not found, the signature field will be added at a default position (centered at the bottom of the last page).
363
- *
364
- * Note: Ensure that the input PDF contains the anchor defined by `anchorText` for the signature field to be positioned correctly. Otherwise, it will be added at a default position.
365
- */
366
- addSignatureFieldSignatureDebtorRaw(pdf: Uint8Array | Buffer, fieldName?: string, anchorText?: string): Promise<Uint8Array<ArrayBufferLike>>;
359
+ private readonly puppeteerService;
360
+ constructor(puppeteerService: PuppeteerService);
361
+ /**
362
+ * @param html HTML string to convert to PDF
363
+ * @param options PDF generation options (optional)
364
+ * @returns PDF generated from the provided HTML
365
+ * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
366
+ */
367
+ generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
368
+ /**
369
+ * @param template Handlebars template string
370
+ * @param parameters Data parameters to inject into the template
371
+ * @param options PDF generation options (optional)
372
+ * @returns PDF generated from the provided Handlebars template with parameters applied
373
+ * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
374
+ */
375
+ generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
376
+ /**
377
+ * @param file Path to the Handlebars template file
378
+ * @param parameters Data parameters to inject into the template
379
+ * @param options PDF generation options (optional)
380
+ * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
381
+ * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
382
+ */
383
+ generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
384
+ /**
385
+ * @param template MJML template string
386
+ * @param options PDF generation options (optional)
387
+ * @returns PDF generated from the provided MJML template
388
+ * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
389
+ */
390
+ generatePdfFromMjmlString(template: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
391
+ /**
392
+ * @param file Path to the MJML template file
393
+ * @param options PDF generation options (optional)
394
+ * @returns PDF generated from the MJML template at the provided file path
395
+ * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
396
+ */
397
+ generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
398
+ /**
399
+ * @param template EJS template string
400
+ * @param data Data to inject into the template
401
+ * @param options PDF generation options (optional)
402
+ * @returns PDF generated from the provided EJS template with data applied
403
+ * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
404
+ */
405
+ generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
406
+ /**
407
+ * @param file Path to the EJS template file
408
+ * @param data Data to inject into the template
409
+ * @param options PDF generation options (optional)
410
+ * @returns PDF generated from the EJS template at the provided file path with data applied
411
+ * @description This method generates a PDF from an EJS template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
412
+ */
413
+ generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
414
+ /**
415
+ * @param template Pug template string
416
+ * @param data Data to inject into the template
417
+ * @param options PDF generation options (optional)
418
+ * @returns PDF generated from the provided Pug template with data applied
419
+ * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
420
+ */
421
+ generatePdfFromPugString(template: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
422
+ /**
423
+ * @param file Path to the Pug template file
424
+ * @param data Data to inject into the template
425
+ * @param options PDF generation options (optional)
426
+ * @returns PDF generated from the Pug template at the provided file path with data applied
427
+ * @description This method generates a PDF from a Pug template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
428
+ */
429
+ generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
430
+ /**
431
+ * @param template Nunjucks template string
432
+ * @param data Data to inject into the template
433
+ * @param options PDF generation options (optional)
434
+ * @returns PDF generated from the provided Nunjucks template with data applied
435
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
436
+ */
437
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
438
+ /**
439
+ * @param file Path to the Nunjucks template file
440
+ * @param data Data to inject into the template
441
+ * @param options PDF generation options (optional)
442
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
443
+ * @description This method generates a PDF from a Nunjucks template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
444
+ */
445
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
446
+ /**
447
+ * @param template Eta template string
448
+ * @param data Data to inject into the template
449
+ * @param options PDF generation options (optional)
450
+ * @returns PDF generated from the provided Eta template with data applied
451
+ * @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
452
+ */
453
+ generatePdfFromEtaString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
454
+ /**
455
+ * @param file Path to the Eta template file
456
+ * @param data Data to inject into the template
457
+ * @param options PDF generation options (optional)
458
+ * @returns PDF generated from the Eta template at the provided file path with data applied
459
+ * @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
460
+ */
461
+ generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
462
+ /**
463
+ * @param template Mustache template string
464
+ * @param data Data to inject into the template
465
+ * @param options PDF generation options (optional)
466
+ * @returns PDF generated from the provided Mustache template with data applied
467
+ * @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
468
+ */
469
+ generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
470
+ /**
471
+ * @param file Path to the Mustache template file
472
+ * @param data Data to inject into the template
473
+ * @param options PDF generation options (optional)
474
+ * @returns PDF generated from the Mustache template at the provided file path with data applied
475
+ * @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
476
+ */
477
+ generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
478
+ /**
479
+ * @param pdf The PDF bytes to modify
480
+ * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
481
+ * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
482
+ * @returns Modified PDF with a signature field added at the anchor position
483
+ * @description This method adds a signature field to a PDF using a text anchor as a reference for the field position. It uses the `addSignatureFieldUsingAnchor` function which finds the anchor in the PDF and inserts a signature field at that location. The signature field is named according to the `fieldName` parameter and the anchor is defined by `anchorText`.
484
+ *
485
+ * Usage example:
486
+ * ```typescript
487
+ * const modifiedPdf = await pdfService.addSignatureFieldSignatureDebtorRaw(
488
+ * originalPdfBytes,
489
+ * 'SignatureDebtor',
490
+ * '__SIG_DEBTOR_ANCHOR__'
491
+ * );
492
+ * ```
493
+ *
494
+ * In this example, `originalPdfBytes` is a byte array representing the original PDF, `SignatureDebtor` is the name of the signature field to add, and `__SIG_DEBTOR_ANCHOR__` is the anchor text used to position the signature field in the PDF.
495
+ *
496
+ * If the anchor is not found, the signature field will be added at a default position (centered at the bottom of the last page).
497
+ *
498
+ * Note: Ensure that the input PDF contains the anchor defined by `anchorText` for the signature field to be positioned correctly. Otherwise, it will be added at a default position.
499
+ */
500
+ addSignatureFieldSignatureDebtorRaw(pdf: Uint8Array | Buffer, fieldName?: string, anchorText?: string): Promise<Uint8Array<ArrayBufferLike>>;
367
501
  }
368
-
502
+ //#endregion
503
+ //#region src/puppeteer/puppeteer.module.d.ts
369
504
  interface PuppeteerModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
370
- inject?: (InjectionToken | OptionalFactoryDependency)[];
371
- useFactory: (...args: any[]) => Promise<PuppeteerParameters> | PuppeteerParameters;
505
+ inject?: (InjectionToken | OptionalFactoryDependency)[];
506
+ useFactory: (...args: any[]) => Promise<PuppeteerParameters> | PuppeteerParameters;
372
507
  }
373
508
  declare class PuppeteerModule implements OnModuleInit {
374
- private readonly browserService;
375
- private readonly pdfParams;
376
- constructor(browserService: BrowserService, pdfParams: PuppeteerParameters);
377
- onModuleInit(): Promise<void>;
378
- static forRoot(pdfParameters: PuppeteerParameters): DynamicModule;
379
- static forRootAsync(options: PuppeteerModuleAsyncOptions): DynamicModule;
509
+ private readonly browserService;
510
+ private readonly pdfParams;
511
+ constructor(browserService: BrowserService, pdfParams: PuppeteerParameters);
512
+ onModuleInit(): Promise<void>;
513
+ static forRoot(pdfParameters: PuppeteerParameters): DynamicModule;
514
+ static forRootAsync(options: PuppeteerModuleAsyncOptions): DynamicModule;
380
515
  }
381
-
516
+ //#endregion
517
+ //#region src/helpers/getRelativePath.helper.d.ts
382
518
  /**
383
519
  * Get the relative path to a value from the module directory.
384
520
  * @param moduleDir the path of the module, typically __dirname
@@ -389,5 +525,6 @@ declare class PuppeteerModule implements OnModuleInit {
389
525
  * // returns 'context/pdf/templates/my-template.hbs' if the current working directory is '/
390
526
  */
391
527
  declare function getRelativePathToValue(moduleDir: string, relativeToModule: string): string;
392
-
393
- export { type EjsOptions, EjsService, type EtaOptions, EtaService, MjmlService, type MustacheOptions, MustacheService, NestjsPdfModule, NestjsPdfService, type NunjucksOptions, NunjucksService, type PdfLibModuleAsyncOptions, type PugOptions, PugService, PuppeteerModule, type PuppeteerModuleAsyncOptions, type PuppeteerParameters, PuppeteerService, getRelativePathToValue };
528
+ //#endregion
529
+ export { EjsOptions, EjsService, EtaOptions, EtaService, MjmlService, MustacheOptions, MustacheService, NestjsPdfModule, NestjsPdfService, NunjucksOptions, NunjucksService, PdfLibModuleAsyncOptions, PugOptions, PugService, PuppeteerModule, PuppeteerModuleAsyncOptions, PuppeteerParameters, PuppeteerService, getRelativePathToValue };
530
+ //# sourceMappingURL=index.d.mts.map