chromiumly 4.1.0 → 4.1.1
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
CHANGED
|
@@ -352,6 +352,7 @@ Similarly to Chromium's route `convert` method, this method takes the following
|
|
|
352
352
|
- `reduceImageResolution`: allows turning on or off image resolution reduction to tweak image conversion performance.
|
|
353
353
|
- `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.
|
|
354
354
|
- `maxImageResolution`: specifies if all images will be reduced to the specified DPI value. Possible values are: `75`, `150`, `300`, `600`, and `1200`.
|
|
355
|
+
- `flatten`: a boolean that, when set to true, flattens the split PDF files, making form fields and annotations uneditable.
|
|
355
356
|
|
|
356
357
|
### PDF Engines
|
|
357
358
|
|
|
@@ -439,6 +440,7 @@ Each [Chromium](#chromium) and [LibreOffice](#libreoffice) route has a `split` p
|
|
|
439
440
|
- `mode`: the mode of the split. It can be `pages` or `intervals`.
|
|
440
441
|
- `span`: the span of the split. It is a string that represents the range of pages to split.
|
|
441
442
|
- `unify`: a boolean that allows unifying the split files. Only works when `mode` is `pages`.
|
|
443
|
+
- `flatten`: a boolean that, when set to true, flattens the split PDF files, making form fields and annotations uneditable.
|
|
442
444
|
|
|
443
445
|
```typescript
|
|
444
446
|
import { UrlConverter } from "chromiumly";
|
|
@@ -469,6 +471,18 @@ const buffer = await PDFEngines.split({
|
|
|
469
471
|
|
|
470
472
|
> ⚠️ **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.
|
|
471
473
|
|
|
474
|
+
### PDF Flattening
|
|
475
|
+
|
|
476
|
+
PDF flattening converts interactive elements like forms and annotations into a static PDF. This ensures the document looks the same everywhere and prevents further edits.
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
import { PDFEngines } from "chromiumly";
|
|
480
|
+
|
|
481
|
+
const buffer = await PDFEngines.flatten({
|
|
482
|
+
files: ["path/to/file_1.pdf", "path/to/file_2.pdf"],
|
|
483
|
+
});
|
|
484
|
+
```
|
|
485
|
+
|
|
472
486
|
## Snippet
|
|
473
487
|
|
|
474
488
|
The following is a short snippet of how to use the library.
|
|
@@ -35,7 +35,7 @@ class PDFEnginesUtils {
|
|
|
35
35
|
const extension = path_1.default.extname(_filename);
|
|
36
36
|
if (extension === '.pdf') {
|
|
37
37
|
const content = yield (0, fs_1.openAsBlob)(file);
|
|
38
|
-
data.append(
|
|
38
|
+
data.append('files', content, _filename);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
throw new Error(`${extension} is not supported`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-engines.utils.js","sourceRoot":"","sources":["../../../src/pdf-engines/utils/pdf-engines.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAiE;AACjE,wDAAwB;AACxB,qDAA6C;AAE7C,yCAAoE;AAMpE;;GAEG;AACH,MAAa,eAAe;IACxB;;;;;;OAMG;IACI,MAAM,CAAO,QAAQ,CACxB,KAA6B,EAC7B,IAAc;;YAEd,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;YACtD,MAAM,OAAO,CAAC,GAAG,CACb,KAAK,CAAC,GAAG,CAAC,CAAO,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC5B,MAAM,QAAQ,GAAG,OAAO,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC;gBAC7E,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBACrD,CAAC;qBAAM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tC,CAAC;YAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,UAAU,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC9D,CAAC;YAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;YACtE,CAAC;YAED,IAAI,SAAS,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACpD,CAAC;QACL,CAAC;KAAA;CACJ;AAxED,0CAwEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chromiumly",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "A lightweight Typescript library that interacts with Gotenberg's different modules to convert a variety of document formats to PDF files.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|