chromiumly 4.4.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -20
- package/dist/chromium/converters/html.converter.d.ts +1 -1
- package/dist/chromium/converters/html.converter.js +4 -3
- package/dist/chromium/converters/html.converter.js.map +1 -1
- package/dist/chromium/converters/markdown.converter.d.ts +1 -1
- package/dist/chromium/converters/markdown.converter.js +4 -3
- package/dist/chromium/converters/markdown.converter.js.map +1 -1
- package/dist/chromium/converters/url.converter.d.ts +1 -1
- package/dist/chromium/converters/url.converter.js +4 -3
- package/dist/chromium/converters/url.converter.js.map +1 -1
- package/dist/chromium/interfaces/converter.types.d.ts +3 -1
- package/dist/chromium/screenshots/html.screenshot.js +1 -1
- package/dist/chromium/screenshots/html.screenshot.js.map +1 -1
- package/dist/chromium/screenshots/markdown.screenshot.js +1 -1
- package/dist/chromium/screenshots/markdown.screenshot.js.map +1 -1
- package/dist/chromium/screenshots/url.screenshot.js +1 -1
- package/dist/chromium/screenshots/url.screenshot.js.map +1 -1
- package/dist/chromium/utils/converter.utils.js +3 -0
- package/dist/chromium/utils/converter.utils.js.map +1 -1
- package/dist/common/gotenberg.utils.d.ts +5 -5
- package/dist/common/gotenberg.utils.js +9 -6
- package/dist/common/gotenberg.utils.js.map +1 -1
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +3 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/pdf-engine-rotate.utils.d.ts +5 -0
- package/dist/common/pdf-engine-rotate.utils.js +17 -0
- package/dist/common/pdf-engine-rotate.utils.js.map +1 -0
- package/dist/common/types.d.ts +6 -0
- package/dist/gotenberg.d.ts +5 -0
- package/dist/gotenberg.js +10 -0
- package/dist/gotenberg.js.map +1 -1
- package/dist/libre-office/interfaces/libre-office.types.d.ts +3 -1
- package/dist/libre-office/libre-office.d.ts +2 -1
- package/dist/libre-office/libre-office.js +5 -3
- package/dist/libre-office/libre-office.js.map +1 -1
- package/dist/libre-office/utils/libre-office.utils.js +3 -0
- package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
- package/dist/main.config.d.ts +40 -3
- package/dist/main.config.js +60 -4
- package/dist/main.config.js.map +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/pdf-engines/interfaces/pdf-engines.types.d.ts +10 -2
- package/dist/pdf-engines/pdf-engines.d.ts +16 -16
- package/dist/pdf-engines/pdf-engines.js +29 -9
- package/dist/pdf-engines/pdf-engines.js.map +1 -1
- package/dist/templates/generators/generator.d.ts +18 -0
- package/dist/templates/generators/generator.js +25 -0
- package/dist/templates/generators/generator.js.map +1 -0
- package/dist/templates/generators/templates.d.ts +8 -0
- package/dist/templates/generators/templates.js +44 -0
- package/dist/templates/generators/templates.js.map +1 -0
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.js +6 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/interfaces/templates.types.d.ts +46 -0
- package/dist/templates/interfaces/templates.types.js +3 -0
- package/dist/templates/interfaces/templates.types.js.map +1 -0
- package/dist/templates/validators/templates.validators.d.ts +6 -0
- package/dist/templates/validators/templates.validators.js +63 -0
- package/dist/templates/validators/templates.validators.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,19 +10,68 @@
|
|
|
10
10
|
[](https://npm-stat.com/charts.html?package=chromiumly)
|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
A lightweight
|
|
14
|
-
|
|
13
|
+
A lightweight TypeScript client for [Gotenberg](https://gotenberg.dev/)’s HTTP API. Use it against your own Gotenberg container or against the **Chromiumly hosted API**—same client, different backend.
|
|
14
|
+
|
|
15
|
+
| | Self‑hosted [Gotenberg](https://github.com/gotenberg/gotenberg) | [Chromiumly hosted API](https://chromiumly.dev) |
|
|
16
|
+
| :------------------------ | :------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| **What it is** | Official open‑source PDF stack (Docker image) | Managed service at `https://api.chromiumly.dev` |
|
|
18
|
+
| **What Chromiumly calls** | Documented Gotenberg routes (Chromium, LibreOffice, PDF engines, …) | Those same routes, **plus** [Templates](#templates-hosted-api-only) (not in open‑source Gotenberg) |
|
|
19
|
+
| **Configuration** | `GOTENBERG_ENDPOINT` | `CHROMIUMLY_API_KEY` (no endpoint) |
|
|
20
|
+
|
|
21
|
+
Everything in this README that maps to [gotenberg.dev](https://gotenberg.dev/) applies to **both** backends unless a section says otherwise. **[Templates](#templates-hosted-api-only) are Chromiumly hosted API only**—they are not a Gotenberg feature and do not work with a self‑hosted instance.
|
|
22
|
+
|
|
23
|
+
## API Key Authentication (Hosted API)
|
|
24
|
+
|
|
25
|
+
Chromiumly provides a managed API at `https://api.chromiumly.dev`. Hosted API support was introduced in `chromiumly@5.0.0` and is available only in Chromiumly `5.0.0+`. If you prefer not to run Gotenberg yourself, you avoid Docker and server ops. Sign up at `https://chromiumly.dev`, get an API key, and call the same conversion routes as with self‑hosting. The hosted API also exposes **[Templates](#templates-hosted-api-only)** (invoice PDFs from structured data), which are **not** available on self‑hosted Gotenberg.
|
|
26
|
+
|
|
27
|
+
When using the hosted API, **you do not need to set `GOTENBERG_ENDPOINT`**. Just provide your API key:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
CHROMIUMLY_API_KEY=your-api-key
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Once the environment variable is set, Chromiumly will automatically send all requests to the hosted API using your key.
|
|
34
|
+
|
|
35
|
+
You can also configure the hosted API programmatically without an endpoint:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Chromiumly } from "chromiumly";
|
|
39
|
+
|
|
40
|
+
Chromiumly.configure({
|
|
41
|
+
apiKey: "your-api-key",
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Minimal usage example (hosted API)
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { UrlConverter } from "chromiumly";
|
|
49
|
+
|
|
50
|
+
async function run() {
|
|
51
|
+
const urlConverter = new UrlConverter();
|
|
52
|
+
|
|
53
|
+
const buffer = await urlConverter.convert({
|
|
54
|
+
url: "https://www.example.com/",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Write the buffer to disk, send it over HTTP, etc.
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
run();
|
|
61
|
+
```
|
|
15
62
|
|
|
16
63
|
# Table of Contents
|
|
17
64
|
|
|
18
|
-
1. [
|
|
65
|
+
1. [API Key Authentication (Hosted API)](#api-key-authentication-hosted-api)
|
|
66
|
+
2. [Getting Started](#getting-started)
|
|
19
67
|
- [Installation](#installation)
|
|
20
68
|
- [Prerequisites](#prerequisites)
|
|
21
69
|
- [Configuration](#configuration)
|
|
22
|
-
|
|
70
|
+
3. [Authentication](#authentication)
|
|
23
71
|
- [Basic Authentication](#basic-authentication)
|
|
72
|
+
- [API Key Authentication](#api-key-authentication)
|
|
24
73
|
- [Advanced Authentication](#advanced-authentication)
|
|
25
|
-
|
|
74
|
+
4. [Core Features](#core-features)
|
|
26
75
|
- [Chromium](#chromium)
|
|
27
76
|
- [URL](#url)
|
|
28
77
|
- [HTML](#html)
|
|
@@ -32,14 +81,16 @@ a variety of document formats to PDF files.
|
|
|
32
81
|
- [PDF Engines](#pdf-engines)
|
|
33
82
|
- [Format Conversion](#format-conversion)
|
|
34
83
|
- [Merging](#merging)
|
|
84
|
+
- [PDF Rotation](#pdf-rotation)
|
|
35
85
|
- [Metadata Management](#metadata-management)
|
|
36
86
|
- [File Generation](#file-generation)
|
|
37
87
|
- [PDF Splitting](#pdf-splitting)
|
|
38
88
|
- [PDF Flattening](#pdf-flattening)
|
|
39
89
|
- [PDF Encryption](#pdf-encryption)
|
|
40
90
|
- [Embedding Files](#embedding-files)
|
|
91
|
+
- [Templates (hosted API only)](#templates-hosted-api-only)
|
|
41
92
|
- [Watermark and stamp](#watermark-and-stamp)
|
|
42
|
-
|
|
93
|
+
5. [Usage Example](#snippet)
|
|
43
94
|
|
|
44
95
|
## Getting Started
|
|
45
96
|
|
|
@@ -59,8 +110,9 @@ yarn add chromiumly
|
|
|
59
110
|
|
|
60
111
|
### Prerequisites
|
|
61
112
|
|
|
62
|
-
|
|
63
|
-
|
|
113
|
+
If you are using the hosted API key option at `https://api.chromiumly.dev`, you **do not need Docker** or a local Gotenberg instance — the service is fully managed for you.
|
|
114
|
+
|
|
115
|
+
If you prefer to self‑host Gotenberg, be sure you install [Docker](https://www.docker.com/) if you have not already done so.
|
|
64
116
|
|
|
65
117
|
After that, you can start a default Docker container of [Gotenberg](https://gotenberg.dev/) as follows:
|
|
66
118
|
|
|
@@ -71,7 +123,7 @@ docker run --rm -p 3000:3000 gotenberg/gotenberg:8
|
|
|
71
123
|
### Configuration
|
|
72
124
|
|
|
73
125
|
Chromiumly supports configurations via both [dotenv](https://www.npmjs.com/package/dotenv)
|
|
74
|
-
and [config](https://www.npmjs.com/package/config) configuration libraries or directly via code to add Gotenberg endpoint to your project
|
|
126
|
+
and [config](https://www.npmjs.com/package/config) configuration libraries or directly via code to add a Gotenberg endpoint to your project when you are **self‑hosting**.
|
|
75
127
|
|
|
76
128
|
#### dotenv
|
|
77
129
|
|
|
@@ -145,6 +197,10 @@ Chromiumly.configure({
|
|
|
145
197
|
});
|
|
146
198
|
```
|
|
147
199
|
|
|
200
|
+
### API Key Authentication
|
|
201
|
+
|
|
202
|
+
API key authentication is primarily intended for the **hosted Chromiumly API** at `https://api.chromiumly.dev`. For setup and examples, see [API Key Authentication (Hosted API)](#api-key-authentication-hosted-api). When both API key and basic auth are configured, the API key takes precedence.
|
|
203
|
+
|
|
148
204
|
### Advanced Authentication
|
|
149
205
|
|
|
150
206
|
To implement advanced authentication or add custom HTTP headers to your requests, you can use the `customHttpHeaders` option within the `configure` method. This allows you to pass additional headers, such as authentication tokens or custom metadata, with each API call.
|
|
@@ -165,10 +221,9 @@ Chromiumly.configure({
|
|
|
165
221
|
|
|
166
222
|
## Core Features
|
|
167
223
|
|
|
168
|
-
Chromiumly
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
`string` (i.e. file path), `Buffer`, or `ReadStream`.
|
|
224
|
+
Chromiumly wraps Gotenberg’s HTTP API: classes mirror the routes described in [Gotenberg’s docs](https://gotenberg.dev/docs/getting-started/introduction). Methods that take files accept a path `string`, `Buffer`, or `ReadStream` (e.g. `html`, `header`, `footer`, `markdown`).
|
|
225
|
+
|
|
226
|
+
The **`Templates`** class is the exception—it talks only to the Chromiumly hosted API and is documented [below](#templates-hosted-api-only).
|
|
172
227
|
|
|
173
228
|
### Chromium
|
|
174
229
|
|
|
@@ -473,6 +528,22 @@ const buffer = await PDFEngines.merge({
|
|
|
473
528
|
|
|
474
529
|
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
530
|
|
|
531
|
+
Optional `rotate` (`{ angle: 90 | 180 | 270; pages?: string }`) rotates pages after merge via the PDF engine; omit `pages` or leave it empty to rotate all pages.
|
|
532
|
+
|
|
533
|
+
#### PDF Rotation
|
|
534
|
+
|
|
535
|
+
`PDFEngines.rotate()` calls Gotenberg’s [rotate route](https://gotenberg.dev/docs/manipulate-pdfs/rotate-pdfs) to rotate existing PDFs. The same post-processing is available on `PDFEngines.merge()`, `PDFEngines.split()`, and on Chromium and LibreOffice `convert()` through the optional `rotate` property (Gotenberg generates the PDF, then rotates selected pages—an extra pass).
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
import { PDFEngines } from "chromiumly";
|
|
539
|
+
|
|
540
|
+
const rotated = await PDFEngines.rotate({
|
|
541
|
+
files: ["path/to/document.pdf"],
|
|
542
|
+
angle: 90,
|
|
543
|
+
pages: "1-3", // optional; omit for all pages
|
|
544
|
+
});
|
|
545
|
+
```
|
|
546
|
+
|
|
476
547
|
#### Watermark and stamp (dedicated routes)
|
|
477
548
|
|
|
478
549
|
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).
|
|
@@ -576,7 +647,7 @@ const buffer = await PDFEngines.split({
|
|
|
576
647
|
});
|
|
577
648
|
```
|
|
578
649
|
|
|
579
|
-
`PDFEngines.split` also accepts optional `watermark` and `
|
|
650
|
+
`PDFEngines.split` also accepts optional `watermark`, `stamp`, and `rotate` for the same PDF-engine post-processing as merge.
|
|
580
651
|
|
|
581
652
|
> ⚠️ **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.
|
|
582
653
|
|
|
@@ -628,16 +699,131 @@ const buffer = await htmlConverter.convert({
|
|
|
628
699
|
|
|
629
700
|
All embedded files will be attached to the generated PDF and can be extracted using PDF readers that support file attachments.
|
|
630
701
|
|
|
702
|
+
### Templates (hosted API only)
|
|
703
|
+
|
|
704
|
+
The `Templates` class is **not** part of open‑source Gotenberg. It generates PDFs from structured payloads on the Chromiumly hosted API and **requires `CHROMIUMLY_API_KEY`**. Hosted API features (including `Templates`) were introduced in `chromiumly@5.0.0` and require Chromiumly `5.0.0+`—pointing Chromiumly at `GOTENBERG_ENDPOINT` (self‑hosted Gotenberg) will not enable this feature.
|
|
705
|
+
|
|
706
|
+
The following template types are currently available:
|
|
707
|
+
|
|
708
|
+
| Type | Description |
|
|
709
|
+
| -------------------- | ------------------ |
|
|
710
|
+
| `invoice_saas` | SaaS-style invoice |
|
|
711
|
+
| `invoice_freelancer` | Freelancer invoice |
|
|
712
|
+
| `invoice_classic` | Classic invoice |
|
|
713
|
+
| `invoice_minimal` | Minimal invoice |
|
|
714
|
+
| `invoice_modern` | Modern invoice |
|
|
715
|
+
|
|
716
|
+
#### Basic Usage
|
|
717
|
+
|
|
718
|
+
```typescript
|
|
719
|
+
import { Templates } from "chromiumly";
|
|
720
|
+
|
|
721
|
+
const templates = new Templates();
|
|
722
|
+
const buffer = await templates.generate({
|
|
723
|
+
type: "invoice_saas",
|
|
724
|
+
data: {
|
|
725
|
+
invoiceNumber: "INV-319",
|
|
726
|
+
createdDate: "2026-03-19",
|
|
727
|
+
dueDate: "2026-04-02",
|
|
728
|
+
companyLogo: "https://cdn.acmecloud.com/assets/logo-mark.png",
|
|
729
|
+
sender: {
|
|
730
|
+
name: "Acme Cloud LLC",
|
|
731
|
+
addressLine1: "450 Madison Ave",
|
|
732
|
+
addressLine2: "New York, NY 10022",
|
|
733
|
+
},
|
|
734
|
+
receiver: {
|
|
735
|
+
name: "Northwind Health Inc.",
|
|
736
|
+
addressLine1: "221 Harbor Blvd",
|
|
737
|
+
addressLine2: "San Diego, CA 92101",
|
|
738
|
+
},
|
|
739
|
+
items: [
|
|
740
|
+
{
|
|
741
|
+
description: "Platform Subscription (Annual)",
|
|
742
|
+
qty: 1,
|
|
743
|
+
unitPrice: "1500.00",
|
|
744
|
+
amount: "1500.00",
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
description: "Onboarding",
|
|
748
|
+
qty: 1,
|
|
749
|
+
unitPrice: "300.00",
|
|
750
|
+
amount: "300.00",
|
|
751
|
+
},
|
|
752
|
+
],
|
|
753
|
+
currency: "USD",
|
|
754
|
+
subTotal: "1800.00",
|
|
755
|
+
taxRate: 8.25,
|
|
756
|
+
taxAmount: "148.50",
|
|
757
|
+
total: "1948.50",
|
|
758
|
+
footerNote: "Payment due in 14 days.",
|
|
759
|
+
footerDisclaimer: "Late fees may apply.",
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
#### Payload Validation
|
|
765
|
+
|
|
766
|
+
Pass `{ validate: true }` to run runtime validation on the data before sending the request. An error is thrown if the payload does not match the expected structure for the given template type.
|
|
767
|
+
|
|
768
|
+
```typescript
|
|
769
|
+
const buffer = await templates.generate(request, { validate: true });
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
#### Payload Shape
|
|
773
|
+
|
|
774
|
+
```typescript
|
|
775
|
+
type TemplateRequest<TType extends TemplateType> = {
|
|
776
|
+
type: TType;
|
|
777
|
+
data: TemplateDataByType[TType];
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
interface InvoiceSaasTemplateData {
|
|
781
|
+
invoiceNumber: string;
|
|
782
|
+
createdDate: string;
|
|
783
|
+
dueDate: string;
|
|
784
|
+
companyLogo: string;
|
|
785
|
+
sender: TemplateParty;
|
|
786
|
+
receiver: TemplateParty;
|
|
787
|
+
items: InvoiceItem[];
|
|
788
|
+
currency: Currency;
|
|
789
|
+
subTotal: string;
|
|
790
|
+
taxRate: number;
|
|
791
|
+
taxAmount: string;
|
|
792
|
+
total: string;
|
|
793
|
+
footerNote: string;
|
|
794
|
+
footerDisclaimer: string;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
interface TemplateParty {
|
|
798
|
+
name: string;
|
|
799
|
+
addressLine1: string;
|
|
800
|
+
addressLine2: string;
|
|
801
|
+
tax?: string;
|
|
802
|
+
iban?: string;
|
|
803
|
+
bic?: string;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
interface InvoiceItem {
|
|
807
|
+
description: string;
|
|
808
|
+
qty: number;
|
|
809
|
+
unitPrice: string;
|
|
810
|
+
amount: string;
|
|
811
|
+
}
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
The `currency` field accepts any [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code exported as the `Currency` type (e.g. `"USD"`, `"EUR"`, `"GBP"`).
|
|
815
|
+
|
|
631
816
|
### Watermark and stamp
|
|
632
817
|
|
|
633
818
|
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
819
|
|
|
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.
|
|
820
|
+
| API | What to pass |
|
|
821
|
+
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
|
822
|
+
| `UrlConverter` / `HtmlConverter` / `MarkdownConverter` `convert()` | `watermark`, `stamp`, `rotate` on the options object (see `ConversionOptions` above) |
|
|
823
|
+
| `LibreOffice.convert()` | Native fields (`nativeWatermarkText`, …) and/or `watermark`, `stamp`, `rotate` |
|
|
824
|
+
| `PDFEngines.merge()` / `PDFEngines.split()` | Optional `watermark`, `stamp`, `rotate` |
|
|
825
|
+
| `PDFEngines.rotate()` | Dedicated endpoint; `files`, `angle` (`90` \| `180` \| `270`), optional `pages` |
|
|
826
|
+
| `PDFEngines.watermark()` / `PDFEngines.stamp()` | Dedicated endpoints; `watermark` or `stamp` config is required |
|
|
641
827
|
|
|
642
828
|
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
829
|
|
|
@@ -42,5 +42,5 @@ export declare class HtmlConverter extends Converter {
|
|
|
42
42
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
43
43
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
44
44
|
*/
|
|
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, watermark, stamp }: 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, watermark, stamp, rotate }: HtmlConversionOptions): Promise<Buffer>;
|
|
46
46
|
}
|
|
@@ -49,7 +49,7 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
49
49
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
50
50
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
51
51
|
*/
|
|
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, watermark, stamp }) {
|
|
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, watermark, stamp, rotate }) {
|
|
53
53
|
const data = new FormData();
|
|
54
54
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
55
55
|
if (assets?.length) {
|
|
@@ -83,9 +83,10 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
83
83
|
ownerPassword,
|
|
84
84
|
embeds,
|
|
85
85
|
watermark,
|
|
86
|
-
stamp
|
|
86
|
+
stamp,
|
|
87
|
+
rotate
|
|
87
88
|
});
|
|
88
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
89
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
exports.HtmlConverter = HtmlConverter;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EACN,SAAS,EACT,KAAK,
|
|
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,EACN,SAAS,EACT,KAAK,EACL,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;YACN,SAAS;YACT,KAAK;YACL,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,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AA7HD,sCA6HC"}
|
|
@@ -43,5 +43,5 @@ export declare class MarkdownConverter extends Converter {
|
|
|
43
43
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
44
44
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
45
45
|
*/
|
|
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, watermark, stamp }: 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, watermark, stamp, rotate }: MarkdownConversionOptions): Promise<Buffer>;
|
|
47
47
|
}
|
|
@@ -50,7 +50,7 @@ class MarkdownConverter extends converter_1.Converter {
|
|
|
50
50
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
51
51
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
52
52
|
*/
|
|
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, watermark, stamp }) {
|
|
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, watermark, stamp, rotate }) {
|
|
54
54
|
const data = new FormData();
|
|
55
55
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
56
56
|
await common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
|
|
@@ -82,9 +82,10 @@ class MarkdownConverter extends converter_1.Converter {
|
|
|
82
82
|
ownerPassword,
|
|
83
83
|
embeds,
|
|
84
84
|
watermark,
|
|
85
|
-
stamp
|
|
85
|
+
stamp,
|
|
86
|
+
rotate
|
|
86
87
|
});
|
|
87
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
88
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
exports.MarkdownConverter = MarkdownConverter;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EACN,SAAS,EACT,KAAK,
|
|
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,EACN,SAAS,EACT,KAAK,EACL,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;YACN,SAAS;YACT,KAAK;YACL,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,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AAxHD,8CAwHC"}
|
|
@@ -42,5 +42,5 @@ export declare class UrlConverter extends Converter {
|
|
|
42
42
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
43
43
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
44
44
|
*/
|
|
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, watermark, stamp }: 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, watermark, stamp, rotate }: UrlConversionOptions): Promise<Buffer>;
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ class UrlConverter extends converter_1.Converter {
|
|
|
50
50
|
* @param {Split} [options.split] - Split the PDF into multiple files.
|
|
51
51
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
52
52
|
*/
|
|
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, watermark, stamp }) {
|
|
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, watermark, stamp, rotate }) {
|
|
54
54
|
const _url = new url_1.URL(url);
|
|
55
55
|
const data = new FormData();
|
|
56
56
|
data.append('url', _url.href);
|
|
@@ -82,9 +82,10 @@ class UrlConverter extends converter_1.Converter {
|
|
|
82
82
|
ownerPassword,
|
|
83
83
|
embeds,
|
|
84
84
|
watermark,
|
|
85
|
-
stamp
|
|
85
|
+
stamp,
|
|
86
|
+
rotate
|
|
86
87
|
});
|
|
87
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
88
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
exports.UrlConverter = UrlConverter;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EACN,SAAS,EACT,KAAK,
|
|
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,CA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AE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AArHD,oCAqHC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Metadata, PathLikeOrReadStream, PdfFormat, PdfEngineStamp, PdfEngineWatermark } from '../../common';
|
|
2
|
-
import { Split } from '../../common/types';
|
|
2
|
+
import { PdfEngineRotate, Split } from '../../common/types';
|
|
3
3
|
import { ChromiumOptions, Cookie } from './common.types';
|
|
4
4
|
type PageSize = {
|
|
5
5
|
width: number | string;
|
|
@@ -48,6 +48,8 @@ export type ConversionOptions = ChromiumOptions & {
|
|
|
48
48
|
watermark?: PdfEngineWatermark;
|
|
49
49
|
/** PDF-engine post-processing stamp (on top of content) */
|
|
50
50
|
stamp?: PdfEngineStamp;
|
|
51
|
+
/** PDF-engine post-process page rotation */
|
|
52
|
+
rotate?: PdfEngineRotate;
|
|
51
53
|
};
|
|
52
54
|
export type HtmlConversionOptions = ConversionOptions & {
|
|
53
55
|
html: PathLikeOrReadStream;
|
|
@@ -66,7 +66,7 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
|
|
|
66
66
|
ownerPassword,
|
|
67
67
|
embeds
|
|
68
68
|
});
|
|
69
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
69
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.HtmlScreenshot = HtmlScreenshot;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;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,
|
|
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,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AAzFD,wCAyFC"}
|
|
@@ -68,7 +68,7 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
|
|
|
68
68
|
ownerPassword,
|
|
69
69
|
embeds
|
|
70
70
|
});
|
|
71
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
71
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
exports.MarkdownScreenshot = MarkdownScreenshot;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;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,
|
|
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,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AA7FD,gDA6FC"}
|
|
@@ -68,7 +68,7 @@ class UrlScreenshot extends screenshot_1.Screenshot {
|
|
|
68
68
|
ownerPassword,
|
|
69
69
|
embeds
|
|
70
70
|
});
|
|
71
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders());
|
|
71
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey());
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
exports.UrlScreenshot = UrlScreenshot;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;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,
|
|
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,EACjC,wBAAU,CAAC,kBAAkB,EAAE,CAClC,CAAC;IACN,CAAC;CACJ;AA1FD,sCA0FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAiE;AACjE,gDAAwB;AACxB,qDAA6C;AAM7C,
|
|
1
|
+
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAiE;AACjE,gDAAwB;AACxB,qDAA6C;AAM7C,yCAKsB;AAEtB;;GAEG;AACH,MAAa,cAAc;IACvB;;;;;OAKG;IACK,MAAM,CAAC,iBAAiB,CAAC,KAAa;QAC1C,OAAO,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC3B,IAAc,EACd,cAA8B;QAE9B,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,cAAc,CA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AAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,cAAc,CAAC,qBAAqB,CACtC,OAAO,CAAC,MAAM,EACd,IAAI,EACJ,QAAQ,CACX,CAAC;QACN,CAAC;QAED,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,qCAA4B,CAAC,6BAA6B,CAC5D,IAAI,EACJ;gBACI,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;aACvB,CACJ,CAAC;QACN,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAA,8BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;CACJ;AA7WD,wCA6WC"}
|
|
@@ -15,15 +15,15 @@ export declare class GotenbergUtils {
|
|
|
15
15
|
* Performs a POST request to the specified Gotenberg endpoint with the provided FormData.
|
|
16
16
|
*
|
|
17
17
|
* @param {string} endpoint - The Gotenberg endpoint URL.
|
|
18
|
-
* @param {string} username - The username for basic authentication.
|
|
19
|
-
* @param {string} password - The password for basic authentication.
|
|
20
|
-
* @param {Record<string, string>} [customHttpHeaders] - Custom HTTP headers to be sent with the request.
|
|
21
18
|
* @param {FormData} data - The FormData object to be sent in the POST request.
|
|
22
|
-
* @param {
|
|
19
|
+
* @param {string} [username] - The username for basic authentication.
|
|
20
|
+
* @param {string} [password] - The password for basic authentication.
|
|
21
|
+
* @param {Record<string, string>} [customHttpHeaders] - Custom HTTP headers to be sent with the request.
|
|
22
|
+
* @param {string} [apiKey] - The API key for X-Api-Key authentication. When set, takes precedence over basic auth.
|
|
23
23
|
* @returns {Promise<Buffer>} A Promise that resolves to the response body as a buffer.
|
|
24
24
|
* @throws {Error} Throws an error if the HTTP response status is not OK.
|
|
25
25
|
*/
|
|
26
|
-
static fetch(endpoint: string, data: FormData, username?: string, password?: string, customHttpHeaders?: Record<string, string
|
|
26
|
+
static fetch(endpoint: string, data: FormData, username?: string, password?: string, customHttpHeaders?: Record<string, string>, apiKey?: string): Promise<Buffer>;
|
|
27
27
|
/**
|
|
28
28
|
* Adds a file to the FormData object.
|
|
29
29
|
*
|
|
@@ -23,19 +23,22 @@ class GotenbergUtils {
|
|
|
23
23
|
* Performs a POST request to the specified Gotenberg endpoint with the provided FormData.
|
|
24
24
|
*
|
|
25
25
|
* @param {string} endpoint - The Gotenberg endpoint URL.
|
|
26
|
-
* @param {string} username - The username for basic authentication.
|
|
27
|
-
* @param {string} password - The password for basic authentication.
|
|
28
|
-
* @param {Record<string, string>} [customHttpHeaders] - Custom HTTP headers to be sent with the request.
|
|
29
26
|
* @param {FormData} data - The FormData object to be sent in the POST request.
|
|
30
|
-
* @param {
|
|
27
|
+
* @param {string} [username] - The username for basic authentication.
|
|
28
|
+
* @param {string} [password] - The password for basic authentication.
|
|
29
|
+
* @param {Record<string, string>} [customHttpHeaders] - Custom HTTP headers to be sent with the request.
|
|
30
|
+
* @param {string} [apiKey] - The API key for X-Api-Key authentication. When set, takes precedence over basic auth.
|
|
31
31
|
* @returns {Promise<Buffer>} A Promise that resolves to the response body as a buffer.
|
|
32
32
|
* @throws {Error} Throws an error if the HTTP response status is not OK.
|
|
33
33
|
*/
|
|
34
|
-
static async fetch(endpoint, data, username, password, customHttpHeaders) {
|
|
34
|
+
static async fetch(endpoint, data, username, password, customHttpHeaders, apiKey) {
|
|
35
35
|
const headers = {
|
|
36
36
|
...customHttpHeaders
|
|
37
37
|
};
|
|
38
|
-
if (
|
|
38
|
+
if (apiKey) {
|
|
39
|
+
headers['X-Api-Key'] = apiKey;
|
|
40
|
+
}
|
|
41
|
+
else if (username && password) {
|
|
39
42
|
const authHeader = 'Basic ' +
|
|
40
43
|
Buffer.from(username + ':' + password).toString('base64');
|
|
41
44
|
headers['Authorization'] = authHeader;
|