@adnsistemas/pdf-lib 2.6.3 → 2.6.4
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/cjs/api/PDFDocument.d.ts.map +1 -1
- package/cjs/api/PDFDocument.js +9 -5
- package/cjs/api/PDFDocument.js.map +1 -1
- package/cjs/api/PDFDocumentOptions.d.ts +1 -0
- package/cjs/api/PDFDocumentOptions.d.ts.map +1 -1
- package/dist/pdf-lib.esm.js +9 -5
- package/dist/pdf-lib.esm.js.map +1 -1
- package/dist/pdf-lib.esm.min.js +1 -1
- package/dist/pdf-lib.esm.min.js.map +1 -1
- package/dist/pdf-lib.js +9 -5
- package/dist/pdf-lib.js.map +1 -1
- package/dist/pdf-lib.min.js +1 -1
- package/dist/pdf-lib.min.js.map +1 -1
- package/es/api/PDFDocument.d.ts.map +1 -1
- package/es/api/PDFDocument.js +9 -5
- package/es/api/PDFDocument.js.map +1 -1
- package/es/api/PDFDocumentOptions.d.ts +1 -0
- package/es/api/PDFDocumentOptions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/PDFDocument.ts +10 -4
- package/src/api/PDFDocumentOptions.ts +1 -0
- package/ts3.4/cjs/api/PDFDocumentOptions.d.ts +1 -0
- package/ts3.4/es/api/PDFDocumentOptions.d.ts +1 -0
package/dist/pdf-lib.js
CHANGED
|
@@ -37048,7 +37048,10 @@ end\
|
|
|
37048
37048
|
*/
|
|
37049
37049
|
save(options = {}) {
|
|
37050
37050
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37051
|
-
|
|
37051
|
+
// check PDF version
|
|
37052
|
+
const vparts = this.context.header.getVersionString().split('.');
|
|
37053
|
+
const uOS = options.rewrite || Number(vparts[0]) > 1 || Number(vparts[1]) >= 5;
|
|
37054
|
+
const { useObjectStreams = uOS, objectsPerTick = 50, rewrite = false, } = options;
|
|
37052
37055
|
assertIs(useObjectStreams, 'useObjectStreams', ['boolean']);
|
|
37053
37056
|
assertIs(objectsPerTick, 'objectsPerTick', ['number']);
|
|
37054
37057
|
assertIs(rewrite, 'rewrite', ['boolean']);
|
|
@@ -37091,13 +37094,14 @@ end\
|
|
|
37091
37094
|
*/
|
|
37092
37095
|
saveIncremental(snapshot, options = {}) {
|
|
37093
37096
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37097
|
+
// check PDF version
|
|
37098
|
+
const vparts = this.context.header.getVersionString().split('.');
|
|
37099
|
+
const uOS = Number(vparts[0]) > 1 || Number(vparts[1]) >= 5;
|
|
37094
37100
|
const { objectsPerTick = 50 } = options;
|
|
37095
37101
|
assertIs(objectsPerTick, 'objectsPerTick', ['number']);
|
|
37096
|
-
const saveOptions = Object.assign(Object.assign({}, options), { addDefaultPage: false, updateFieldAppearances: false });
|
|
37102
|
+
const saveOptions = Object.assign(Object.assign({ useObjectStreams: uOS }, options), { addDefaultPage: false, updateFieldAppearances: false });
|
|
37097
37103
|
yield this.prepareForSave(saveOptions);
|
|
37098
|
-
const Writer =
|
|
37099
|
-
? PDFStreamWriter
|
|
37100
|
-
: PDFWriter;
|
|
37104
|
+
const Writer = saveOptions.useObjectStreams ? PDFStreamWriter : PDFWriter;
|
|
37101
37105
|
return Writer.forContextWithSnapshot(this.context, objectsPerTick, snapshot).serializeToBuffer();
|
|
37102
37106
|
});
|
|
37103
37107
|
}
|