chromiumly 4.2.4 → 4.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.
Files changed (50) hide show
  1. package/README.md +89 -18
  2. package/dist/chromium/converters/html.converter.d.ts +2 -1
  3. package/dist/chromium/converters/html.converter.js +3 -1
  4. package/dist/chromium/converters/html.converter.js.map +1 -1
  5. package/dist/chromium/converters/markdown.converter.d.ts +2 -1
  6. package/dist/chromium/converters/markdown.converter.js +3 -1
  7. package/dist/chromium/converters/markdown.converter.js.map +1 -1
  8. package/dist/chromium/converters/url.converter.d.ts +2 -1
  9. package/dist/chromium/converters/url.converter.js +3 -1
  10. package/dist/chromium/converters/url.converter.js.map +1 -1
  11. package/dist/chromium/interfaces/common.types.d.ts +5 -0
  12. package/dist/chromium/interfaces/converter.types.d.ts +5 -1
  13. package/dist/chromium/screenshots/html.screenshot.d.ts +2 -1
  14. package/dist/chromium/screenshots/html.screenshot.js +3 -1
  15. package/dist/chromium/screenshots/html.screenshot.js.map +1 -1
  16. package/dist/chromium/screenshots/markdown.screenshot.d.ts +2 -1
  17. package/dist/chromium/screenshots/markdown.screenshot.js +3 -1
  18. package/dist/chromium/screenshots/markdown.screenshot.js.map +1 -1
  19. package/dist/chromium/screenshots/url.screenshot.d.ts +2 -1
  20. package/dist/chromium/screenshots/url.screenshot.js +3 -1
  21. package/dist/chromium/screenshots/url.screenshot.js.map +1 -1
  22. package/dist/chromium/utils/converter.utils.js +9 -0
  23. package/dist/chromium/utils/converter.utils.js.map +1 -1
  24. package/dist/chromium/utils/screenshot.utils.js +3 -0
  25. package/dist/chromium/utils/screenshot.utils.js.map +1 -1
  26. package/dist/common/constants.d.ts +1 -1
  27. package/dist/common/constants.js +1 -1
  28. package/dist/common/index.d.ts +2 -0
  29. package/dist/common/index.js +3 -1
  30. package/dist/common/index.js.map +1 -1
  31. package/dist/common/pdf-engine-watermark-stamp.types.d.ts +29 -0
  32. package/dist/common/pdf-engine-watermark-stamp.types.js +3 -0
  33. package/dist/common/pdf-engine-watermark-stamp.types.js.map +1 -0
  34. package/dist/common/pdf-engine-watermark-stamp.utils.d.ts +23 -0
  35. package/dist/common/pdf-engine-watermark-stamp.utils.js +86 -0
  36. package/dist/common/pdf-engine-watermark-stamp.utils.js.map +1 -0
  37. package/dist/libre-office/interfaces/libre-office.types.d.ts +19 -1
  38. package/dist/libre-office/utils/libre-office.utils.d.ts +1 -0
  39. package/dist/libre-office/utils/libre-office.utils.js +62 -0
  40. package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
  41. package/dist/main.config.d.ts +5 -1
  42. package/dist/main.config.js +5 -1
  43. package/dist/main.config.js.map +1 -1
  44. package/dist/main.d.ts +1 -0
  45. package/dist/main.js.map +1 -1
  46. package/dist/pdf-engines/interfaces/pdf-engines.types.d.ts +3 -1
  47. package/dist/pdf-engines/pdf-engines.d.ts +27 -3
  48. package/dist/pdf-engines/pdf-engines.js +38 -2
  49. package/dist/pdf-engines/pdf-engines.js.map +1 -1
  50. package/package.json +9 -9
package/README.md CHANGED
@@ -38,6 +38,7 @@ a variety of document formats to PDF files.
38
38
  - [PDF Flattening](#pdf-flattening)
39
39
  - [PDF Encryption](#pdf-encryption)
40
40
  - [Embedding Files](#embedding-files)
41
+ - [Watermark and stamp](#watermark-and-stamp)
41
42
  4. [Usage Example](#snippet)
42
43
 
43
44
  ## Getting Started
@@ -165,17 +166,17 @@ Chromiumly.configure({
165
166
  ## Core Features
166
167
 
167
168
  Chromiumly introduces different classes that serve as wrappers to
168
- Gotenberg's [routes](https://gotenberg.dev/docs/routes). These classes encompass methods featuring an
169
+ Gotenberg's [documentation](https://gotenberg.dev/docs/getting-started/introduction). These classes encompass methods featuring an
169
170
  input file parameter, such as `html`, `header`, `footer`, and `markdown`, capable of accepting inputs in the form of a
170
171
  `string` (i.e. file path), `Buffer`, or `ReadStream`.
171
172
 
172
173
  ### Chromium
173
174
 
174
175
  There are three different classes that come with a single method (i.e.`convert`) which calls one of
175
- Chromium's [Conversion routes](https://gotenberg.dev/docs/routes#convert-with-chromium) to convert `html` and `markdown` files, or
176
+ Chromium's [conversion routes](https://gotenberg.dev/docs/convert-with-chromium/convert-url-to-pdf) to convert `html` and `markdown` files, or
176
177
  a `url` to a `buffer` which contains the converted PDF file content.
177
178
 
178
- Similarly, a new set of classes have been added to harness the recently introduced Gotenberg [Screenshot routes](https://gotenberg.dev/docs/routes#screenshots-route). These classes include a single method called `capture`, which allows capturing full-page screenshots of `html`, `markdown`, and `url`.
179
+ Similarly, a new set of classes have been added to harness the recently introduced Gotenberg [screenshot routes](https://gotenberg.dev/docs/convert-with-chromium/screenshot-url). These classes include a single method called `capture`, which allows capturing full-page screenshots of `html`, `markdown`, and `url`.
179
180
 
180
181
  #### URL
181
182
 
@@ -314,6 +315,7 @@ type ConversionOptions = {
314
315
  header?: PathLikeOrReadStream; // Specify a custom header for the PDF
315
316
  footer?: PathLikeOrReadStream; // Specify a custom footer for the PDF
316
317
  emulatedMediaType?: EmulatedMediaType; // Specify the emulated media type for conversion
318
+ emulatedMediaFeatures?: EmulatedMediaFeature[]; // Override CSS media features (e.g., prefers-color-scheme). Default: None.
317
319
  waitDelay?: string; // Duration (e.g., '5s') to wait when loading an HTML document before conversion
318
320
  waitForExpression?: string; // JavaScript expression to wait before converting an HTML document into PDF
319
321
  waitForSelector?: string; // CSS selector to wait for before converting an HTML document into PDF until it matches a node
@@ -331,6 +333,28 @@ type ConversionOptions = {
331
333
  userPassword?: string; // Password for opening the resulting PDF(s).
332
334
  ownerPassword?: string; // Password for full access on the resulting PDF(s).
333
335
  embeds?: PathLikeOrReadStream[]; // Files to embed in the generated PDF.
336
+ watermark?: PdfEngineWatermark; // Optional PDF-engine post-processing watermark (behind page content).
337
+ stamp?: PdfEngineStamp; // Optional PDF-engine post-processing stamp (on top of page content).
338
+ };
339
+ ```
340
+
341
+ Optional `watermark` and `stamp` use the same multipart field names as [Gotenberg’s PDF-engine watermark/stamp](https://gotenberg.dev/docs/manipulate-pdfs/watermark-pdfs): text, image, or PDF sources, with JSON `options` depending on your configured engine (e.g. pdfcpu). See [Watermark PDFs](https://gotenberg.dev/docs/manipulate-pdfs/watermark-pdfs) and [Stamp PDFs](https://gotenberg.dev/docs/manipulate-pdfs/stamp-pdfs) in the official docs.
342
+
343
+ ```typescript
344
+ type PdfEngineWatermark = {
345
+ source?: "text" | "image" | "pdf";
346
+ expression?: string; // Text, or filename of the uploaded asset when source is image or pdf
347
+ pages?: string; // Page ranges (e.g. "1-3"); omit for all pages
348
+ options?: Record<string, unknown>; // Serialized as JSON (engine-specific)
349
+ file?: PathLikeOrReadStream | Buffer; // Required when source is image or pdf
350
+ };
351
+
352
+ type PdfEngineStamp = {
353
+ source?: "text" | "image" | "pdf";
354
+ expression?: string;
355
+ pages?: string;
356
+ options?: Record<string, unknown>;
357
+ file?: PathLikeOrReadStream | Buffer;
334
358
  };
335
359
  ```
336
360
 
@@ -357,6 +381,7 @@ type ScreenshotOptions = {
357
381
  header?: PathLikeOrReadStream;
358
382
  footer?: PathLikeOrReadStream;
359
383
  emulatedMediaType?: EmulatedMediaType;
384
+ emulatedMediaFeatures?: EmulatedMediaFeature[]; // Override CSS media features (e.g., prefers-color-scheme). Default: None.
360
385
  waitDelay?: string; // Duration (e.g, '5s') to wait when loading an HTML document before convertion.
361
386
  waitForExpression?: string; // JavaScript's expression to wait before converting an HTML document into PDF until it returns true.
362
387
  waitForSelector?: string; // CSS selector to wait for before converting an HTML document into PDF until it matches a node.
@@ -378,8 +403,8 @@ type ScreenshotOptions = {
378
403
 
379
404
  ### LibreOffice
380
405
 
381
- The `LibreOffice` class comes with a single method `convert`. This method interacts with [LibreOffice](https://gotenberg.dev/docs/routes#convert-with-libreoffice) route to convert different documents to PDF files. You can find the file extensions
382
- accepted [here](https://gotenberg.dev/docs/routes#convert-with-libreoffice).
406
+ The `LibreOffice` class comes with a single method `convert`. This method interacts with [LibreOffice](https://gotenberg.dev/docs/convert-with-libreoffice/convert-to-pdf) route to convert different documents to PDF files. You can find the file extensions
407
+ accepted [here](https://gotenberg.dev/docs/convert-with-libreoffice/convert-to-pdf).
383
408
 
384
409
  ```typescript
385
410
  import { LibreOffice } from "chromiumly";
@@ -400,7 +425,7 @@ Similarly to Chromium's route `convert` method, this method takes the following
400
425
  - `pdfUA`: enables PDF for Universal Access for optimal accessibility.
401
426
  - `merge`: merges all the resulting files from the conversion into an individual PDF file.
402
427
  - `metadata`: writes metadata to the generated PDF file.
403
- - `lolosslessImageCompression`: allows turning lossless compression on or off to tweak image conversion performance.
428
+ - `losslessImageCompression`: allows turning lossless compression on or off to tweak image conversion performance.
404
429
  - `reduceImageResolution`: allows turning on or off image resolution reduction to tweak image conversion performance.
405
430
  - `quality`: specifies the quality of the JPG export. The value ranges from 1 to 100, with higher values producing higher-quality images and larger file sizes.
406
431
  - `maxImageResolution`: specifies if all images will be reduced to the specified DPI value. Possible values are: `75`, `150`, `300`, `600`, and `1200`.
@@ -408,14 +433,16 @@ Similarly to Chromium's route `convert` method, this method takes the following
408
433
  - `userPassword`: password for opening the resulting PDF(s).
409
434
  - `ownerPassword`: password for full access on the resulting PDF(s).
410
435
  - `embeds`: files to embed in the generated PDF (repeatable). This feature enables the creation of PDFs compatible with standards like [ZUGFeRD / Factur-X](https://fnfe-mpe.org/factur-x/), which require embedding XML invoices and other files within the PDF.
436
+ - **Native LibreOffice watermarks** (applied during export): `nativeWatermarkText`, `nativeWatermarkColor`, `nativeWatermarkFontHeight`, `nativeWatermarkRotateAngle`, `nativeWatermarkFontName`, `nativeTiledWatermarkText` — see [Convert to PDF](https://gotenberg.dev/docs/convert-with-libreoffice/convert-to-pdf).
437
+ - **PDF-engine watermark/stamp** (post-processing after conversion): `watermark` and `stamp` — same shapes as in Chromium `ConversionOptions` (`PdfEngineWatermark` / `PdfEngineStamp`). For `{ data, ext }` file objects, use the same pattern as in `files`.
411
438
 
412
439
  ### PDF Engines
413
440
 
414
- The `PDFEngines` class interacts with Gotenberg's [PDF Engines](https://gotenberg.dev/docs/routes#convert-into-pdfa--pdfua-route) routes to manipulate PDF files.
441
+ The `PDFEngines` class interacts with Gotenberg's [PDF Engines](https://gotenberg.dev/docs/manipulate-pdfs/pdfa-pdfua) routes to manipulate PDF files.
415
442
 
416
443
  #### Format Conversion
417
444
 
418
- This method interacts with [PDF Engines](https://gotenberg.dev/docs/routes#convert-into-pdfa--pdfua-route) convertion route to transform PDF files into the requested PDF/A format and/or PDF/UA.
445
+ This method interacts with [PDF Engines](https://gotenberg.dev/docs/manipulate-pdfs/pdfa-pdfua) convertion route to transform PDF files into the requested PDF/A format and/or PDF/UA.
419
446
 
420
447
  ```typescript
421
448
  import { PDFEngines } from "chromiumly";
@@ -429,7 +456,7 @@ const buffer = await PDFEngines.convert({
429
456
 
430
457
  #### Merging
431
458
 
432
- This method interacts with [PDF Engines](https://gotenberg.dev/docs/routes#merge-pdfs-route) merge route which gathers different
459
+ This method interacts with [PDF Engines](https://gotenberg.dev/docs/manipulate-pdfs/merge-pdfs) merge route which gathers different
433
460
  engines that can manipulate and merge PDF files such
434
461
  as: [PDFtk](https://gitlab.com/pdftk-java/pdftk), [PDFcpu](https://github.com/pdfcpu/pdfcpu), [QPDF](https://github.com/qpdf/qpdf),
435
462
  and [UNO](https://github.com/unoconv/unoconv).
@@ -444,6 +471,34 @@ const buffer = await PDFEngines.merge({
444
471
  });
445
472
  ```
446
473
 
474
+ Optional `watermark` and `stamp` (`PdfEngineWatermark` / `PdfEngineStamp`) apply PDF-engine post-processing to the merged output, matching [Merge PDFs](https://gotenberg.dev/docs/manipulate-pdfs/merge-pdfs) in the Gotenberg docs.
475
+
476
+ #### Watermark and stamp (dedicated routes)
477
+
478
+ These methods call [`/forms/pdfengines/watermark`](https://gotenberg.dev/docs/manipulate-pdfs/watermark-pdfs) and [`/forms/pdfengines/stamp`](https://gotenberg.dev/docs/manipulate-pdfs/stamp-pdfs).
479
+
480
+ ```typescript
481
+ import { PDFEngines } from "chromiumly";
482
+
483
+ const watermarked = await PDFEngines.watermark({
484
+ files: ["path/to/document.pdf"],
485
+ watermark: {
486
+ source: "text",
487
+ expression: "CONFIDENTIAL",
488
+ options: { opacity: 0.25, rotation: 45 },
489
+ },
490
+ });
491
+
492
+ const stamped = await PDFEngines.stamp({
493
+ files: ["path/to/document.pdf"],
494
+ stamp: {
495
+ source: "text",
496
+ expression: "APPROVED",
497
+ options: { opacity: 0.5, rotation: 0 },
498
+ },
499
+ });
500
+ ```
501
+
447
502
  #### Metadata Management
448
503
 
449
504
  ##### readMetadata
@@ -467,15 +522,12 @@ This method writes metadata to the provided PDF files.
467
522
  import { PDFEngines } from "chromiumly";
468
523
 
469
524
  const buffer = await PDFEngines.writeMetadata({
470
- files: [
471
- "path/to/file_1.pdf",
472
- "path/to/file_2.pdf",
473
- ],
525
+ files: ["path/to/file_1.pdf", "path/to/file_2.pdf"],
474
526
  metadata: {
475
- Author: 'Taha Cherfia',
476
- Tite: 'Chromiumly'
477
- Keywords: ['pdf', 'html', 'gotenberg'],
478
- }
527
+ Author: "Taha Cherfia",
528
+ Title: "Chromiumly",
529
+ Keywords: ["pdf", "html", "gotenberg"],
530
+ },
479
531
  });
480
532
  ```
481
533
 
@@ -509,7 +561,7 @@ const buffer = await UrlConverter.convert({
509
561
  });
510
562
  ```
511
563
 
512
- On the other hand, PDFEngines' has a `split` method that interacts with [PDF Engines](https://gotenberg.dev/docs/routes#split-pdfs-route) split route which splits PDF files into multiple files.
564
+ On the other hand, PDFEngines' has a `split` method that interacts with [PDF Engines](https://gotenberg.dev/docs/manipulate-pdfs/split-pdfs) split route which splits PDF files into multiple files.
513
565
 
514
566
  ```typescript
515
567
  import { PDFEngines } from "chromiumly";
@@ -524,6 +576,8 @@ const buffer = await PDFEngines.split({
524
576
  });
525
577
  ```
526
578
 
579
+ `PDFEngines.split` also accepts optional `watermark` and `stamp` for the same PDF-engine post-processing as merge.
580
+
527
581
  > ⚠️ **Note**: Gotenberg does not currently validate the `span` value when `mode` is set to `pages`, as the validation depends on the chosen engine for the split feature. See [PDF Engines module configuration](https://gotenberg.dev/docs/configuration#pdf-engines) for more details.
528
582
 
529
583
  ### PDF Flattening
@@ -574,6 +628,19 @@ const buffer = await htmlConverter.convert({
574
628
 
575
629
  All embedded files will be attached to the generated PDF and can be extracted using PDF readers that support file attachments.
576
630
 
631
+ ### Watermark and stamp
632
+
633
+ Gotenberg can apply a **watermark** (behind content) and/or **stamp** (on top of content) using the configured PDF engine after the main conversion or PDF operation. Types `PdfEngineWatermark` and `PdfEngineStamp` are exported from `chromiumly` if you want them explicitly in your code. Chromiumly exposes this on:
634
+
635
+ | API | What to pass |
636
+ | ------------------------------------------------------------------ | -------------------------------------------------------------------------- |
637
+ | `UrlConverter` / `HtmlConverter` / `MarkdownConverter` `convert()` | `watermark`, `stamp` on the options object (see `ConversionOptions` above) |
638
+ | `LibreOffice.convert()` | Native fields (`nativeWatermarkText`, …) and/or `watermark`, `stamp` |
639
+ | `PDFEngines.merge()` / `PDFEngines.split()` | Optional `watermark`, `stamp` |
640
+ | `PDFEngines.watermark()` / `PDFEngines.stamp()` | Dedicated endpoints; `watermark` or `stamp` config is required |
641
+
642
+ For image or PDF sources, set `source` to `image` or `pdf`, set `expression` to the **filename** of the uploaded asset, and pass the file in `file`. Chromium screenshot routes do not document these fields; use HTML/CSS overlays or convert-to-PDF flows instead.
643
+
577
644
  ## Snippet
578
645
 
579
646
  The following is a short snippet of how to use the library.
@@ -593,6 +660,10 @@ async function run() {
593
660
  },
594
661
  },
595
662
  emulatedMediaType: "screen",
663
+ emulatedMediaFeatures: [
664
+ { name: "prefers-color-scheme", value: "dark" },
665
+ { name: "prefers-reduced-motion", value: "reduce" },
666
+ ],
596
667
  failOnHttpStatusCodes: [404],
597
668
  failOnConsoleExceptions: true,
598
669
  skipNetworkIdleEvent: false,
@@ -23,6 +23,7 @@ export declare class HtmlConverter extends Converter {
23
23
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
24
24
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
25
25
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
26
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
26
27
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
27
28
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
28
29
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -41,5 +42,5 @@ export declare class HtmlConverter extends Converter {
41
42
  * @param {Split} [options.split] - Split the PDF into multiple files.
42
43
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
43
44
  */
44
- convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }: HtmlConversionOptions): Promise<Buffer>;
45
+ convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }: HtmlConversionOptions): Promise<Buffer>;
45
46
  }
@@ -30,6 +30,7 @@ class HtmlConverter extends converter_1.Converter {
30
30
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
31
31
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
32
32
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
33
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
33
34
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
34
35
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
35
36
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -48,7 +49,7 @@ class HtmlConverter extends converter_1.Converter {
48
49
  * @param {Split} [options.split] - Split the PDF into multiple files.
49
50
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
50
51
  */
51
- async convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }) {
52
+ async convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }) {
52
53
  const data = new FormData();
53
54
  await common_1.GotenbergUtils.addFile(data, html, 'index.html');
54
55
  if (assets?.length) {
@@ -61,6 +62,7 @@ class HtmlConverter extends converter_1.Converter {
61
62
  pdfFormat,
62
63
  pdfUA,
63
64
  emulatedMediaType,
65
+ emulatedMediaFeatures,
64
66
  waitDelay,
65
67
  waitForExpression,
66
68
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,qBAAS;IACxC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACc;QACpB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACjB,MAAM,OAAO,CAAC,GAAG,CACb,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAC1B,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAC3C,CACJ,CAAC;QACN,CAAC;QAED,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,uBAAuB;YACvB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,KAAK;YACL,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAnHD,sCAmHC"}
1
+ {"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,qBAAS;IACxC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACc;QACpB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACjB,MAAM,OAAO,CAAC,GAAG,CACb,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAC1B,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAC3C,CACJ,CAAC;QACN,CAAC;QAED,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,uBAAuB;YACvB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,KAAK;YACL,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAtHD,sCAsHC"}
@@ -24,6 +24,7 @@ export declare class MarkdownConverter extends Converter {
24
24
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
25
25
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
26
26
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
27
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
27
28
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
28
29
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
29
30
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -42,5 +43,5 @@ export declare class MarkdownConverter extends Converter {
42
43
  * @param {Split} [options.split] - Split the PDF into multiple files.
43
44
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
44
45
  */
45
- convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }: MarkdownConversionOptions): Promise<Buffer>;
46
+ convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }: MarkdownConversionOptions): Promise<Buffer>;
46
47
  }
@@ -31,6 +31,7 @@ class MarkdownConverter extends converter_1.Converter {
31
31
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
32
32
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
33
33
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
34
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
34
35
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
35
36
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
36
37
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -49,7 +50,7 @@ class MarkdownConverter extends converter_1.Converter {
49
50
  * @param {Split} [options.split] - Split the PDF into multiple files.
50
51
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
51
52
  */
52
- async convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }) {
53
+ async convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, split, userPassword, ownerPassword, embeds }) {
53
54
  const data = new FormData();
54
55
  await common_1.GotenbergUtils.addFile(data, html, 'index.html');
55
56
  await common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
@@ -60,6 +61,7 @@ class MarkdownConverter extends converter_1.Converter {
60
61
  pdfFormat,
61
62
  pdfUA,
62
63
  emulatedMediaType,
64
+ emulatedMediaFeatures,
63
65
  waitDelay,
64
66
  waitForExpression,
65
67
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAC5C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACkB;QACxB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAExD,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,KAAK;YACL,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AA9GD,8CA8GC"}
1
+ {"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAC5C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACkB;QACxB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAExD,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,KAAK;YACL,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAjHD,8CAiHC"}
@@ -23,6 +23,7 @@ export declare class UrlConverter extends Converter {
23
23
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
24
24
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
25
25
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
26
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
26
27
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
27
28
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
28
29
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -41,5 +42,5 @@ export declare class UrlConverter extends Converter {
41
42
  * @param {Split} [options.split] - Split the PDF into multiple files.
42
43
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
43
44
  */
44
- convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, metadata, cookies, downloadFrom, generateDocumentOutline, split, userPassword, ownerPassword, embeds }: UrlConversionOptions): Promise<Buffer>;
45
+ convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, metadata, cookies, downloadFrom, generateDocumentOutline, split, userPassword, ownerPassword, embeds }: UrlConversionOptions): Promise<Buffer>;
45
46
  }
@@ -31,6 +31,7 @@ class UrlConverter extends converter_1.Converter {
31
31
  * @param {PdfFormat} [options.pdfFormat] - PDF format options.
32
32
  * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
33
33
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
34
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
34
35
  * @param {string} [options.waitDelay] - Delay before the conversion process starts.
35
36
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
36
37
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the conversion.
@@ -49,7 +50,7 @@ class UrlConverter extends converter_1.Converter {
49
50
  * @param {Split} [options.split] - Split the PDF into multiple files.
50
51
  * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
51
52
  */
52
- async convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, metadata, cookies, downloadFrom, generateDocumentOutline, split, userPassword, ownerPassword, embeds }) {
53
+ async convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, metadata, cookies, downloadFrom, generateDocumentOutline, split, userPassword, ownerPassword, embeds }) {
53
54
  const _url = new url_1.URL(url);
54
55
  const data = new FormData();
55
56
  data.append('url', _url.href);
@@ -60,6 +61,7 @@ class UrlConverter extends converter_1.Converter {
60
61
  pdfFormat,
61
62
  pdfUA,
62
63
  emulatedMediaType,
64
+ emulatedMediaFeatures,
63
65
  waitDelay,
64
66
  waitForExpression,
65
67
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,qBAAS;IACvC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACa;QACnB,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,uBAAuB;YACvB,KAAK;YACL,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AA3GD,oCA2GC"}
1
+ {"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,qBAAS;IACvC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACa;QACnB,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;YACjC,MAAM;YACN,MAAM;YACN,UAAU;YACV,SAAS;YACT,KAAK;YACL,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,QAAQ;YACR,OAAO;YACP,YAAY;YACZ,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,uBAAuB;YACvB,KAAK;YACL,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AA9GD,oCA8GC"}
@@ -1,6 +1,10 @@
1
1
  import { PathLikeOrReadStream } from '../../common';
2
2
  import { DownloadFrom } from '../../common/types';
3
3
  export type EmulatedMediaType = 'screen' | 'print';
4
+ export type EmulatedMediaFeature = {
5
+ name: string;
6
+ value: string;
7
+ };
4
8
  export type Cookie = {
5
9
  name: string;
6
10
  value: string;
@@ -14,6 +18,7 @@ export type ChromiumOptions = {
14
18
  header?: PathLikeOrReadStream;
15
19
  footer?: PathLikeOrReadStream;
16
20
  emulatedMediaType?: EmulatedMediaType;
21
+ emulatedMediaFeatures?: EmulatedMediaFeature[];
17
22
  waitDelay?: string;
18
23
  waitForExpression?: string;
19
24
  waitForSelector?: string;
@@ -1,4 +1,4 @@
1
- import { Metadata, PathLikeOrReadStream, PdfFormat } from '../../common';
1
+ import { Metadata, PathLikeOrReadStream, PdfFormat, PdfEngineStamp, PdfEngineWatermark } from '../../common';
2
2
  import { Split } from '../../common/types';
3
3
  import { ChromiumOptions, Cookie } from './common.types';
4
4
  type PageSize = {
@@ -44,6 +44,10 @@ export type ConversionOptions = ChromiumOptions & {
44
44
  userPassword?: string;
45
45
  ownerPassword?: string;
46
46
  embeds?: PathLikeOrReadStream[];
47
+ /** PDF-engine post-processing watermark (behind content) */
48
+ watermark?: PdfEngineWatermark;
49
+ /** PDF-engine post-processing stamp (on top of content) */
50
+ stamp?: PdfEngineStamp;
47
51
  };
48
52
  export type HtmlConversionOptions = ConversionOptions & {
49
53
  html: PathLikeOrReadStream;
@@ -19,6 +19,7 @@ export declare class HtmlScreenshot extends Screenshot {
19
19
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
20
20
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
21
21
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
22
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
22
23
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
23
24
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
24
25
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -34,5 +35,5 @@ export declare class HtmlScreenshot extends Screenshot {
34
35
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
35
36
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
36
37
  */
37
- capture({ html, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, generateDocumentOutline, userPassword, ownerPassword, embeds }: HtmlScreenshotOptions): Promise<Buffer>;
38
+ capture({ html, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, generateDocumentOutline, userPassword, ownerPassword, embeds }: HtmlScreenshotOptions): Promise<Buffer>;
38
39
  }
@@ -26,6 +26,7 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
26
26
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
27
27
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
28
28
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
29
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
29
30
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
30
31
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
31
32
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -41,12 +42,13 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
41
42
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
42
43
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
43
44
  */
44
- async capture({ html, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
45
+ async capture({ html, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
45
46
  const data = new FormData();
46
47
  await common_1.GotenbergUtils.addFile(data, html, 'index.html');
47
48
  await screenshot_utils_1.ScreenshotUtils.customize(data, {
48
49
  properties,
49
50
  emulatedMediaType,
51
+ emulatedMediaFeatures,
50
52
  waitDelay,
51
53
  waitForExpression,
52
54
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,mDAA8D;AAC9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACc;QACpB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,YAAY;YACZ,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AArFD,wCAqFC"}
1
+ {"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,mDAA8D;AAC9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACc;QACpB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,YAAY;YACZ,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAxFD,wCAwFC"}
@@ -20,6 +20,7 @@ export declare class MarkdownScreenshot extends Screenshot {
20
20
  * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be screenshoted.
21
21
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
22
22
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
23
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
23
24
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
24
25
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
25
26
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -35,5 +36,5 @@ export declare class MarkdownScreenshot extends Screenshot {
35
36
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
36
37
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
37
38
  */
38
- capture({ html, markdown, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, generateDocumentOutline, userPassword, ownerPassword, embeds }: MarkdownScreenshotOptions): Promise<Buffer>;
39
+ capture({ html, markdown, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, generateDocumentOutline, userPassword, ownerPassword, embeds }: MarkdownScreenshotOptions): Promise<Buffer>;
39
40
  }
@@ -27,6 +27,7 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
27
27
  * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be screenshoted.
28
28
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
29
29
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
30
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
30
31
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
31
32
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
32
33
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -42,13 +43,14 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
42
43
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
43
44
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
44
45
  */
45
- async capture({ html, markdown, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
46
+ async capture({ html, markdown, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, downloadFrom, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
46
47
  const data = new FormData();
47
48
  await common_1.GotenbergUtils.addFile(data, html, 'index.html');
48
49
  await common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
49
50
  await screenshot_utils_1.ScreenshotUtils.customize(data, {
50
51
  properties,
51
52
  emulatedMediaType,
53
+ emulatedMediaFeatures,
52
54
  waitDelay,
53
55
  waitForExpression,
54
56
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACkB;QACxB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAExD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,YAAY;YACZ,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAzFD,gDAyFC"}
1
+ {"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACkB;QACxB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAExD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,YAAY;YACZ,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AA5FD,gDA4FC"}
@@ -19,6 +19,7 @@ export declare class UrlScreenshot extends Screenshot {
19
19
  * @param {string} options.url - The URL of the content to be screenshoted
20
20
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
21
21
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
22
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
22
23
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
23
24
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
24
25
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -34,5 +35,5 @@ export declare class UrlScreenshot extends Screenshot {
34
35
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
35
36
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
36
37
  */
37
- capture({ url, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, cookies, generateDocumentOutline, userPassword, ownerPassword, embeds }: UrlScreenshotOptions): Promise<Buffer>;
38
+ capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, cookies, generateDocumentOutline, userPassword, ownerPassword, embeds }: UrlScreenshotOptions): Promise<Buffer>;
38
39
  }
@@ -27,6 +27,7 @@ class UrlScreenshot extends screenshot_1.Screenshot {
27
27
  * @param {string} options.url - The URL of the content to be screenshoted
28
28
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
29
29
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
30
+ * @param {EmulatedMediaFeature[]} [options.emulatedMediaFeatures] - Override CSS media features (e.g. prefers-color-scheme).
30
31
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
31
32
  * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the screenshot.
32
33
  * @param {string} [options.waitForSelector] - CSS selector to wait for before completing the screenshot.
@@ -42,13 +43,14 @@ class UrlScreenshot extends screenshot_1.Screenshot {
42
43
  * @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
43
44
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
44
45
  */
45
- async capture({ url, properties, emulatedMediaType, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, cookies, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
46
+ async capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, optimizeForSpeed, cookies, generateDocumentOutline, userPassword, ownerPassword, embeds }) {
46
47
  const _url = new url_1.URL(url);
47
48
  const data = new FormData();
48
49
  data.append('url', _url.href);
49
50
  await screenshot_utils_1.ScreenshotUtils.customize(data, {
50
51
  properties,
51
52
  emulatedMediaType,
53
+ emulatedMediaFeatures,
52
54
  waitDelay,
53
55
  waitForExpression,
54
56
  waitForSelector,
@@ -1 +1 @@
1
- {"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACa;QACnB,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,OAAO;YACP,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAtFD,sCAsFC"}
1
+ {"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,MAAM,EACa;QACnB,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,gBAAgB;YAChB,OAAO;YACP,uBAAuB;YACvB,YAAY;YACZ,aAAa;YACb,MAAM;SACT,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,CACpC,CAAC;IACN,CAAC;CACJ;AAzFD,sCAyFC"}
@@ -156,6 +156,9 @@ class ConverterUtils {
156
156
  if (options.emulatedMediaType) {
157
157
  data.append('emulatedMediaType', options.emulatedMediaType);
158
158
  }
159
+ if (options.emulatedMediaFeatures?.length) {
160
+ data.append('emulatedMediaFeatures', JSON.stringify(options.emulatedMediaFeatures));
161
+ }
159
162
  if (options.properties) {
160
163
  ConverterUtils.addPageProperties(data, options.properties);
161
164
  }
@@ -221,6 +224,12 @@ class ConverterUtils {
221
224
  if (options.embeds && options.embeds.length > 0) {
222
225
  await ConverterUtils.addFilesWithFieldName(options.embeds, data, 'embeds');
223
226
  }
227
+ if (options.watermark || options.stamp) {
228
+ await common_1.PdfEngineWatermarkStampUtils.appendPdfEngineWatermarkStamp(data, {
229
+ watermark: options.watermark,
230
+ stamp: options.stamp
231
+ });
232
+ }
224
233
  }
225
234
  }
226
235
  exports.ConverterUtils = ConverterUtils;