@ironsoftware/ironpdf 2026.4.1 → 2026.6.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/package.json +3 -3
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/index.ts +3 -0
- package/src/internal/IronPdfEngine.ProtoFiles/chrome_render.proto +6 -0
- package/src/internal/IronPdfEngine.ProtoFiles/iron_pdf_service.proto +7 -1
- package/src/internal/IronPdfEngine.ProtoFiles/pdfium_compress.proto +1 -0
- package/src/internal/IronPdfEngine.ProtoFiles/pdfium_form.proto +32 -0
- package/src/internal/IronPdfEngine.ProtoFiles/qpdf.proto +51 -0
- package/src/internal/access.d.ts.map +1 -1
- package/src/internal/access.js +3 -0
- package/src/internal/access.js.map +1 -1
- package/src/internal/access.ts +4 -0
- package/src/internal/generated_proto/iron_pdf_service.d.ts +628 -305
- package/src/internal/generated_proto/iron_pdf_service.d.ts.map +1 -1
- package/src/internal/generated_proto/iron_pdf_service.ts +628 -305
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.d.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.d.ts.map +1 -1
- package/src/internal/generated_proto/ironpdfengineproto/ChromePdfRenderOptionsP.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.d.ts +52 -0
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.d.ts.map +1 -1
- package/src/internal/generated_proto/ironpdfengineproto/IronPdfService.ts +64 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumCompressImagesRequestP.d.ts +2 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumCompressImagesRequestP.d.ts.map +1 -1
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumCompressImagesRequestP.ts +2 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackRequestP.d.ts +8 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackRequestP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackRequestP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackRequestP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackRequestP.ts +11 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackResultP.d.ts +12 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackResultP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackResultP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackResultP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumDisableFormFontFallbackResultP.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontRequestStreamP.d.ts +25 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontRequestStreamP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontRequestStreamP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontRequestStreamP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontRequestStreamP.ts +28 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontResultP.d.ts +12 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontResultP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontResultP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontResultP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/PdfiumSetFormFontResultP.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedFromBytesRequestStreamP.d.ts +23 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedFromBytesRequestStreamP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedFromBytesRequestStreamP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedFromBytesRequestStreamP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedFromBytesRequestStreamP.ts +26 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedRequestP.d.ts +15 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedRequestP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedRequestP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedRequestP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressAndSaveAsAdvancedRequestP.ts +18 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressionFlagsP.d.ts +30 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressionFlagsP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressionFlagsP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressionFlagsP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfCompressionFlagsP.ts +33 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.d.ts +10 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestIdP.ts +13 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.d.ts +18 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.d.ts.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.js +4 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.js.map +1 -0
- package/src/internal/generated_proto/ironpdfengineproto/QPdfLinearizeInMemoryRequestStreamP.ts +21 -0
- package/src/internal/grpc_layer/chrome/converter.d.ts +10 -0
- package/src/internal/grpc_layer/chrome/converter.d.ts.map +1 -1
- package/src/internal/grpc_layer/chrome/converter.js +61 -2
- package/src/internal/grpc_layer/chrome/converter.js.map +1 -1
- package/src/internal/grpc_layer/chrome/converter.ts +67 -0
- package/src/internal/grpc_layer/pdfium/annotations.d.ts +30 -0
- package/src/internal/grpc_layer/pdfium/annotations.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/annotations.js +161 -0
- package/src/internal/grpc_layer/pdfium/annotations.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/annotations.ts +190 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.d.ts +7 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.js +53 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/bookmarks.ts +50 -0
- package/src/internal/grpc_layer/pdfium/compress.d.ts +28 -0
- package/src/internal/grpc_layer/pdfium/compress.d.ts.map +1 -1
- package/src/internal/grpc_layer/pdfium/compress.js +154 -3
- package/src/internal/grpc_layer/pdfium/compress.js.map +1 -1
- package/src/internal/grpc_layer/pdfium/compress.ts +191 -1
- package/src/internal/grpc_layer/pdfium/form.d.ts +15 -0
- package/src/internal/grpc_layer/pdfium/form.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/form.js +99 -0
- package/src/internal/grpc_layer/pdfium/form.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/form.ts +119 -0
- package/src/internal/grpc_layer/pdfium/formFontValidator.d.ts +26 -0
- package/src/internal/grpc_layer/pdfium/formFontValidator.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/formFontValidator.js +81 -0
- package/src/internal/grpc_layer/pdfium/formFontValidator.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/formFontValidator.ts +86 -0
- package/src/internal/grpc_layer/pdfium/linearize.d.ts +48 -0
- package/src/internal/grpc_layer/pdfium/linearize.d.ts.map +1 -0
- package/src/internal/grpc_layer/pdfium/linearize.js +309 -0
- package/src/internal/grpc_layer/pdfium/linearize.js.map +1 -0
- package/src/internal/grpc_layer/pdfium/linearize.ts +338 -0
- package/src/internal/zod/renderSchema.d.ts.map +1 -1
- package/src/internal/zod/renderSchema.js +6 -1
- package/src/internal/zod/renderSchema.js.map +1 -1
- package/src/internal/zod/renderSchema.ts +6 -1
- package/src/public/annotation.d.ts +166 -0
- package/src/public/annotation.d.ts.map +1 -0
- package/src/public/annotation.js +61 -0
- package/src/public/annotation.js.map +1 -0
- package/src/public/annotation.ts +166 -0
- package/src/public/bookmark.d.ts +25 -0
- package/src/public/bookmark.d.ts.map +1 -0
- package/src/public/bookmark.js +3 -0
- package/src/public/bookmark.js.map +1 -0
- package/src/public/bookmark.ts +28 -0
- package/src/public/compression.d.ts +92 -0
- package/src/public/compression.d.ts.map +1 -0
- package/src/public/compression.js +26 -0
- package/src/public/compression.js.map +1 -0
- package/src/public/compression.ts +107 -0
- package/src/public/ironpdfglobalconfig.d.ts +12 -0
- package/src/public/ironpdfglobalconfig.d.ts.map +1 -1
- package/src/public/ironpdfglobalconfig.js +7 -0
- package/src/public/ironpdfglobalconfig.js.map +1 -1
- package/src/public/ironpdfglobalconfig.ts +19 -0
- package/src/public/pdfDocument.d.ts +234 -1
- package/src/public/pdfDocument.d.ts.map +1 -1
- package/src/public/pdfDocument.js +489 -17
- package/src/public/pdfDocument.js.map +1 -1
- package/src/public/pdfDocument.ts +518 -19
- package/src/public/render.d.ts +104 -0
- package/src/public/render.d.ts.map +1 -1
- package/src/public/render.js +35 -1
- package/src/public/render.js.map +1 -1
- package/src/public/render.ts +101 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side validation for {@link setFormFont} arguments. Mirrors the
|
|
3
|
+
* Java FormFontValidator and .NET FormFontValidator added for PDF-2184.
|
|
4
|
+
*
|
|
5
|
+
* The engine validates again on receipt — this client check is the
|
|
6
|
+
* fail-fast layer that surfaces obvious mistakes before any network I/O.
|
|
7
|
+
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
|
+
/// <reference types="node" />
|
|
10
|
+
/**
|
|
11
|
+
* Validate a PDF font name. Allowed characters: letters, digits, '_', '-',
|
|
12
|
+
* '.', '+'. The '+' is permitted to accept subset prefixes like
|
|
13
|
+
* "AAAAAA+Poppins-Regular". Names must be 1-63 characters.
|
|
14
|
+
*
|
|
15
|
+
* @throws Error when the name fails validation.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateFormFontName(fontName: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Validate raw font bytes look like a TrueType / OpenType / TTC sfnt
|
|
20
|
+
* container. Catches the obvious cases: empty payload, oversize payload,
|
|
21
|
+
* ASCII text passed instead of bytes, and all-zero payloads.
|
|
22
|
+
*
|
|
23
|
+
* @throws Error when the data fails validation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateFormFontData(fontData: Buffer): void;
|
|
26
|
+
//# sourceMappingURL=formFontValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFontValidator.d.ts","sourceRoot":"","sources":["formFontValidator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;AAMH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAc3D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CA2C3D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client-side validation for {@link setFormFont} arguments. Mirrors the
|
|
4
|
+
* Java FormFontValidator and .NET FormFontValidator added for PDF-2184.
|
|
5
|
+
*
|
|
6
|
+
* The engine validates again on receipt — this client check is the
|
|
7
|
+
* fail-fast layer that surfaces obvious mistakes before any network I/O.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.validateFormFontData = exports.validateFormFontName = void 0;
|
|
11
|
+
const MAX_NAME_LENGTH = 63;
|
|
12
|
+
const MAX_FONT_BYTES = 50 * 1024 * 1024; // 50 MB
|
|
13
|
+
const ALLOWED_NAME = /^[A-Za-z0-9_\-.+]+$/;
|
|
14
|
+
/**
|
|
15
|
+
* Validate a PDF font name. Allowed characters: letters, digits, '_', '-',
|
|
16
|
+
* '.', '+'. The '+' is permitted to accept subset prefixes like
|
|
17
|
+
* "AAAAAA+Poppins-Regular". Names must be 1-63 characters.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error when the name fails validation.
|
|
20
|
+
*/
|
|
21
|
+
function validateFormFontName(fontName) {
|
|
22
|
+
if (fontName == null || typeof fontName !== "string" || fontName.length === 0) {
|
|
23
|
+
throw new Error("fontName must be a non-empty string");
|
|
24
|
+
}
|
|
25
|
+
if (fontName.length > MAX_NAME_LENGTH) {
|
|
26
|
+
throw new Error(`fontName must be at most ${MAX_NAME_LENGTH} characters (got ${fontName.length})`);
|
|
27
|
+
}
|
|
28
|
+
if (!ALLOWED_NAME.test(fontName)) {
|
|
29
|
+
throw new Error("fontName may only contain letters, digits, and the characters '_', '-', '.', '+'");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.validateFormFontName = validateFormFontName;
|
|
33
|
+
/**
|
|
34
|
+
* Validate raw font bytes look like a TrueType / OpenType / TTC sfnt
|
|
35
|
+
* container. Catches the obvious cases: empty payload, oversize payload,
|
|
36
|
+
* ASCII text passed instead of bytes, and all-zero payloads.
|
|
37
|
+
*
|
|
38
|
+
* @throws Error when the data fails validation.
|
|
39
|
+
*/
|
|
40
|
+
function validateFormFontData(fontData) {
|
|
41
|
+
var _a;
|
|
42
|
+
if (!fontData || fontData.length === 0) {
|
|
43
|
+
throw new Error("fontData must not be empty");
|
|
44
|
+
}
|
|
45
|
+
if (fontData.length > MAX_FONT_BYTES) {
|
|
46
|
+
throw new Error(`fontData exceeds the ${MAX_FONT_BYTES} byte limit (got ${fontData.length})`);
|
|
47
|
+
}
|
|
48
|
+
if (fontData.length < 4) {
|
|
49
|
+
throw new Error("fontData is too small to be a valid font file");
|
|
50
|
+
}
|
|
51
|
+
// Reject obviously-non-font payloads: all-zero buffer or a pure ASCII text
|
|
52
|
+
// payload. We don't try to fully parse the sfnt header here — the engine
|
|
53
|
+
// does that — but we do catch the common mistakes.
|
|
54
|
+
let nonZero = false;
|
|
55
|
+
let asciiOnly = true;
|
|
56
|
+
for (let i = 0; i < Math.min(fontData.length, 4096); i++) {
|
|
57
|
+
const b = (_a = fontData[i]) !== null && _a !== void 0 ? _a : 0;
|
|
58
|
+
if (b !== 0)
|
|
59
|
+
nonZero = true;
|
|
60
|
+
if (b > 0x7e || (b < 0x20 && b !== 0x09 && b !== 0x0a && b !== 0x0d)) {
|
|
61
|
+
asciiOnly = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!nonZero) {
|
|
65
|
+
throw new Error("fontData is all zeros — not a valid font file");
|
|
66
|
+
}
|
|
67
|
+
if (asciiOnly) {
|
|
68
|
+
throw new Error("fontData looks like ASCII text — not a valid font file");
|
|
69
|
+
}
|
|
70
|
+
// sfnt magic — TTF (0x00010000), OTF ('OTTO'), TTC ('ttcf'), or 'true'.
|
|
71
|
+
const m0 = fontData[0], m1 = fontData[1], m2 = fontData[2], m3 = fontData[3];
|
|
72
|
+
const isTtfV1 = m0 === 0x00 && m1 === 0x01 && m2 === 0x00 && m3 === 0x00;
|
|
73
|
+
const isOtto = m0 === 0x4f && m1 === 0x54 && m2 === 0x54 && m3 === 0x4f;
|
|
74
|
+
const isTtcf = m0 === 0x74 && m1 === 0x74 && m2 === 0x63 && m3 === 0x66;
|
|
75
|
+
const isTrue = m0 === 0x74 && m1 === 0x72 && m2 === 0x75 && m3 === 0x65;
|
|
76
|
+
if (!(isTtfV1 || isOtto || isTtcf || isTrue)) {
|
|
77
|
+
throw new Error("fontData does not have a recognised TTF/OTF/TTC sfnt magic");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.validateFormFontData = validateFormFontData;
|
|
81
|
+
//# sourceMappingURL=formFontValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFontValidator.js","sourceRoot":"","sources":["formFontValidator.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AACjD,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,QAAgB;IACpD,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9E,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACvD;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,eAAe,EAAE;QACtC,MAAM,IAAI,KAAK,CACd,4BAA4B,eAAe,oBAAoB,QAAQ,CAAC,MAAM,GAAG,CACjF,CAAC;KACF;IACD,IAAI,CAA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E;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC1E;IAED,wEAAwE;IACxE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;IACzE,MAAM,MAAM,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;IACxE,MAAM,MAAM,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;IACxE,MAAM,MAAM,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;IACxE,IAAI,CAAC,CAAC,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CACd,4DAA4D,CAC5D,CAAC;KACF;AACF,CAAC;AA3CD,oDA2CC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side validation for {@link setFormFont} arguments. Mirrors the
|
|
3
|
+
* Java FormFontValidator and .NET FormFontValidator added for PDF-2184.
|
|
4
|
+
*
|
|
5
|
+
* The engine validates again on receipt — this client check is the
|
|
6
|
+
* fail-fast layer that surfaces obvious mistakes before any network I/O.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const MAX_NAME_LENGTH = 63;
|
|
10
|
+
const MAX_FONT_BYTES = 50 * 1024 * 1024; // 50 MB
|
|
11
|
+
const ALLOWED_NAME = /^[A-Za-z0-9_\-.+]+$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Validate a PDF font name. Allowed characters: letters, digits, '_', '-',
|
|
15
|
+
* '.', '+'. The '+' is permitted to accept subset prefixes like
|
|
16
|
+
* "AAAAAA+Poppins-Regular". Names must be 1-63 characters.
|
|
17
|
+
*
|
|
18
|
+
* @throws Error when the name fails validation.
|
|
19
|
+
*/
|
|
20
|
+
export function validateFormFontName(fontName: string): void {
|
|
21
|
+
if (fontName == null || typeof fontName !== "string" || fontName.length === 0) {
|
|
22
|
+
throw new Error("fontName must be a non-empty string");
|
|
23
|
+
}
|
|
24
|
+
if (fontName.length > MAX_NAME_LENGTH) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`fontName must be at most ${MAX_NAME_LENGTH} characters (got ${fontName.length})`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
if (!ALLOWED_NAME.test(fontName)) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"fontName may only contain letters, digits, and the characters '_', '-', '.', '+'"
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Validate raw font bytes look like a TrueType / OpenType / TTC sfnt
|
|
38
|
+
* container. Catches the obvious cases: empty payload, oversize payload,
|
|
39
|
+
* ASCII text passed instead of bytes, and all-zero payloads.
|
|
40
|
+
*
|
|
41
|
+
* @throws Error when the data fails validation.
|
|
42
|
+
*/
|
|
43
|
+
export function validateFormFontData(fontData: Buffer): void {
|
|
44
|
+
if (!fontData || fontData.length === 0) {
|
|
45
|
+
throw new Error("fontData must not be empty");
|
|
46
|
+
}
|
|
47
|
+
if (fontData.length > MAX_FONT_BYTES) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`fontData exceeds the ${MAX_FONT_BYTES} byte limit (got ${fontData.length})`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (fontData.length < 4) {
|
|
53
|
+
throw new Error("fontData is too small to be a valid font file");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Reject obviously-non-font payloads: all-zero buffer or a pure ASCII text
|
|
57
|
+
// payload. We don't try to fully parse the sfnt header here — the engine
|
|
58
|
+
// does that — but we do catch the common mistakes.
|
|
59
|
+
let nonZero = false;
|
|
60
|
+
let asciiOnly = true;
|
|
61
|
+
for (let i = 0; i < Math.min(fontData.length, 4096); i++) {
|
|
62
|
+
const b = fontData[i] ?? 0;
|
|
63
|
+
if (b !== 0) nonZero = true;
|
|
64
|
+
if (b > 0x7e || (b < 0x20 && b !== 0x09 && b !== 0x0a && b !== 0x0d)) {
|
|
65
|
+
asciiOnly = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!nonZero) {
|
|
69
|
+
throw new Error("fontData is all zeros — not a valid font file");
|
|
70
|
+
}
|
|
71
|
+
if (asciiOnly) {
|
|
72
|
+
throw new Error("fontData looks like ASCII text — not a valid font file");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// sfnt magic — TTF (0x00010000), OTF ('OTTO'), TTC ('ttcf'), or 'true'.
|
|
76
|
+
const m0 = fontData[0], m1 = fontData[1], m2 = fontData[2], m3 = fontData[3];
|
|
77
|
+
const isTtfV1 = m0 === 0x00 && m1 === 0x01 && m2 === 0x00 && m3 === 0x00;
|
|
78
|
+
const isOtto = m0 === 0x4f && m1 === 0x54 && m2 === 0x54 && m3 === 0x4f;
|
|
79
|
+
const isTtcf = m0 === 0x74 && m1 === 0x74 && m2 === 0x63 && m3 === 0x66;
|
|
80
|
+
const isTrue = m0 === 0x74 && m1 === 0x72 && m2 === 0x75 && m3 === 0x65;
|
|
81
|
+
if (!(isTtfV1 || isOtto || isTtcf || isTrue)) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
"fontData does not have a recognised TTF/OTF/TTC sfnt magic"
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { Buffer } from "buffer";
|
|
5
|
+
import { Readable } from "stream";
|
|
6
|
+
import { LinearizationMode } from "../../../public/render";
|
|
7
|
+
/**
|
|
8
|
+
* Check if the given PDF bytes represent a linearized ("Fast Web View") PDF.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isLinearizedFromBytes(pdfBytes: Buffer, password?: string): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Linearize a PDF held by the engine (by document id) and return the linearized bytes
|
|
13
|
+
* via the {@code QPdf_Linearization_LinearizeInMemoryFromId} unary-request/server-streaming RPC.
|
|
14
|
+
*/
|
|
15
|
+
export declare function linearizeInMemoryFromId(id: string, password?: string): Promise<Buffer>;
|
|
16
|
+
/**
|
|
17
|
+
* Linearize a PDF held by the engine (by document id) and stream the linearized bytes
|
|
18
|
+
* as a {@link Readable}. Useful for piping to HTTP responses or file streams without
|
|
19
|
+
* buffering the entire PDF in memory.
|
|
20
|
+
*/
|
|
21
|
+
export declare function linearizeInMemoryFromIdStream(id: string, password?: string): Promise<Readable>;
|
|
22
|
+
/**
|
|
23
|
+
* Linearize a PDF provided as raw bytes and return the linearized bytes via the
|
|
24
|
+
* bidirectional streaming {@code QPdf_Linearization_LinearizeInMemory} RPC.
|
|
25
|
+
*/
|
|
26
|
+
export declare function linearizeInMemoryFromBytes(pdfBytes: Buffer, password?: string): Promise<Buffer>;
|
|
27
|
+
/**
|
|
28
|
+
* Core linearization logic shared across all linearization entry points. Implements the
|
|
29
|
+
* {@link LinearizationMode} strategy pattern. Mirrors {@code PdfDocument.LinearizePdfCore}
|
|
30
|
+
* on the C# side.
|
|
31
|
+
*/
|
|
32
|
+
export declare function linearizeCoreFromBytes(pdfBytes: Buffer, password?: string, mode?: LinearizationMode): Promise<Buffer>;
|
|
33
|
+
/**
|
|
34
|
+
* Variant of {@link linearizeCoreFromBytes} that starts from an open document on the engine.
|
|
35
|
+
* For {@link LinearizationMode.InMemory} we use the cheap document-id RPC; for the disk-based
|
|
36
|
+
* paths we have to fetch the bytes once and delegate to {@link linearizeCoreFromBytes}.
|
|
37
|
+
*/
|
|
38
|
+
export declare function linearizeCoreFromId(id: string, getBytes: () => Promise<Buffer>, password?: string, mode?: LinearizationMode): Promise<Buffer>;
|
|
39
|
+
/**
|
|
40
|
+
* Linearize a PDF provided as raw bytes and save the result to disk via the file-based
|
|
41
|
+
* streaming {@code QPdf_Linearization_SaveAsLinearizedFromBytes} RPC.
|
|
42
|
+
*
|
|
43
|
+
* Mirrors the in-memory behavior used by {@link compressInMemory} in {@code compress.ts}:
|
|
44
|
+
* the engine streams the linearized bytes back, and we concatenate and persist them
|
|
45
|
+
* locally at {@code outputPath}.
|
|
46
|
+
*/
|
|
47
|
+
export declare function saveAsLinearizedFromBytes(pdfBytes: Buffer, outputPath: string, password?: string): Promise<Buffer>;
|
|
48
|
+
//# sourceMappingURL=linearize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linearize.d.ts","sourceRoot":"","sources":["linearize.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAI9B,OAAO,EAAc,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAc7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGzD;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,GACX,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,MAAM,EACV,QAAQ,SAAK,GACX,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CAClD,EAAE,EAAE,MAAM,EACV,QAAQ,SAAK,GACX,OAAO,CAAC,QAAQ,CAAC,CA8BnB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,GACX,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC3C,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,EACb,IAAI,GAAE,iBAA+C,GACnD,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACxC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC/B,QAAQ,SAAK,EACb,IAAI,GAAE,iBAA+C,GACnD,OAAO,CAAC,MAAM,CAAC,CAMjB;AAsDD;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,SAAK,GACX,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.saveAsLinearizedFromBytes = exports.linearizeCoreFromId = exports.linearizeCoreFromBytes = exports.linearizeInMemoryFromBytes = exports.linearizeInMemoryFromIdStream = exports.linearizeInMemoryFromId = exports.isLinearizedFromBytes = void 0;
|
|
36
|
+
const buffer_1 = require("buffer");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const stream_1 = require("stream");
|
|
41
|
+
const access_1 = require("../../access");
|
|
42
|
+
const render_1 = require("../../../public/render");
|
|
43
|
+
const util_1 = require("../util");
|
|
44
|
+
/**
|
|
45
|
+
* Check if the given PDF bytes represent a linearized ("Fast Web View") PDF.
|
|
46
|
+
*/
|
|
47
|
+
function isLinearizedFromBytes(pdfBytes, password = "") {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const client = yield access_1.Access.ensureConnection();
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
const stream = client.QPdf_Linearization_IsLinearized((err, value) => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (err) {
|
|
54
|
+
reject(`${err.name}/n${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
else if (value) {
|
|
57
|
+
if (value.exception) {
|
|
58
|
+
(0, util_1.handleRemoteException)(value.exception, reject);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
resolve((_a = value.result) !== null && _a !== void 0 ? _a : false);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
reject("No response from IronPdfEngine for isLinearized");
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
stream.write({ info: { password: password !== null && password !== void 0 ? password : "" } });
|
|
68
|
+
(0, util_1.chunkBuffer)(pdfBytes).forEach((chunk) => {
|
|
69
|
+
stream.write({ pdfBytesChunk: chunk });
|
|
70
|
+
});
|
|
71
|
+
stream.end();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.isLinearizedFromBytes = isLinearizedFromBytes;
|
|
76
|
+
/**
|
|
77
|
+
* Linearize a PDF held by the engine (by document id) and return the linearized bytes
|
|
78
|
+
* via the {@code QPdf_Linearization_LinearizeInMemoryFromId} unary-request/server-streaming RPC.
|
|
79
|
+
*/
|
|
80
|
+
function linearizeInMemoryFromId(id, password = "") {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const client = yield access_1.Access.ensureConnection();
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
const stream = client.QPdf_Linearization_LinearizeInMemoryFromId({
|
|
85
|
+
document: { documentId: id },
|
|
86
|
+
password: password !== null && password !== void 0 ? password : "",
|
|
87
|
+
});
|
|
88
|
+
const buffers = [];
|
|
89
|
+
stream.on("data", (data) => {
|
|
90
|
+
if (data.exception) {
|
|
91
|
+
(0, util_1.handleRemoteException)(data.exception, reject);
|
|
92
|
+
}
|
|
93
|
+
else if (data.resultChunk) {
|
|
94
|
+
buffers.push(data.resultChunk);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
stream.on("error", (err) => {
|
|
98
|
+
reject(`${err.name}/n${err.message}`);
|
|
99
|
+
});
|
|
100
|
+
stream.on("end", () => {
|
|
101
|
+
resolve(buffer_1.Buffer.concat(buffers));
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
exports.linearizeInMemoryFromId = linearizeInMemoryFromId;
|
|
107
|
+
/**
|
|
108
|
+
* Linearize a PDF held by the engine (by document id) and stream the linearized bytes
|
|
109
|
+
* as a {@link Readable}. Useful for piping to HTTP responses or file streams without
|
|
110
|
+
* buffering the entire PDF in memory.
|
|
111
|
+
*/
|
|
112
|
+
function linearizeInMemoryFromIdStream(id, password = "") {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const client = yield access_1.Access.ensureConnection();
|
|
115
|
+
const passThrough = new stream_1.PassThrough();
|
|
116
|
+
const stream = client.QPdf_Linearization_LinearizeInMemoryFromId({
|
|
117
|
+
document: { documentId: id },
|
|
118
|
+
password: password !== null && password !== void 0 ? password : "",
|
|
119
|
+
});
|
|
120
|
+
stream.on("data", (data) => {
|
|
121
|
+
if (data.exception) {
|
|
122
|
+
passThrough.destroy(new Error(`${data.exception.message}/n${data.exception.remoteStackTrace}`));
|
|
123
|
+
}
|
|
124
|
+
else if (data.resultChunk) {
|
|
125
|
+
passThrough.write(data.resultChunk);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
stream.on("error", (err) => {
|
|
129
|
+
passThrough.destroy(err);
|
|
130
|
+
});
|
|
131
|
+
stream.on("end", () => {
|
|
132
|
+
passThrough.end();
|
|
133
|
+
});
|
|
134
|
+
return passThrough;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
exports.linearizeInMemoryFromIdStream = linearizeInMemoryFromIdStream;
|
|
138
|
+
/**
|
|
139
|
+
* Linearize a PDF provided as raw bytes and return the linearized bytes via the
|
|
140
|
+
* bidirectional streaming {@code QPdf_Linearization_LinearizeInMemory} RPC.
|
|
141
|
+
*/
|
|
142
|
+
function linearizeInMemoryFromBytes(pdfBytes, password = "") {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const client = yield access_1.Access.ensureConnection();
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
const stream = client.QPdf_Linearization_LinearizeInMemory();
|
|
147
|
+
const buffers = [];
|
|
148
|
+
stream.on("data", (data) => {
|
|
149
|
+
if (data.exception) {
|
|
150
|
+
(0, util_1.handleRemoteException)(data.exception, reject);
|
|
151
|
+
}
|
|
152
|
+
else if (data.resultChunk) {
|
|
153
|
+
buffers.push(data.resultChunk);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
stream.on("error", (err) => {
|
|
157
|
+
reject(`${err.name}/n${err.message}`);
|
|
158
|
+
});
|
|
159
|
+
stream.on("end", () => {
|
|
160
|
+
resolve(buffer_1.Buffer.concat(buffers));
|
|
161
|
+
});
|
|
162
|
+
stream.write({ info: { password: password !== null && password !== void 0 ? password : "" } });
|
|
163
|
+
(0, util_1.chunkBuffer)(pdfBytes).forEach((chunk) => {
|
|
164
|
+
stream.write({ pdfBytesChunk: chunk });
|
|
165
|
+
});
|
|
166
|
+
stream.end();
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
exports.linearizeInMemoryFromBytes = linearizeInMemoryFromBytes;
|
|
171
|
+
/**
|
|
172
|
+
* Core linearization logic shared across all linearization entry points. Implements the
|
|
173
|
+
* {@link LinearizationMode} strategy pattern. Mirrors {@code PdfDocument.LinearizePdfCore}
|
|
174
|
+
* on the C# side.
|
|
175
|
+
*/
|
|
176
|
+
function linearizeCoreFromBytes(pdfBytes, password = "", mode = render_1.LinearizationMode.Automatic) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
if (!pdfBytes || pdfBytes.length === 0) {
|
|
179
|
+
throw new Error("The PDF bytes cannot be null or empty.");
|
|
180
|
+
}
|
|
181
|
+
if (mode === render_1.LinearizationMode.InMemory) {
|
|
182
|
+
return linearizeInMemoryFromBytes(pdfBytes, password);
|
|
183
|
+
}
|
|
184
|
+
if (mode === render_1.LinearizationMode.FileBased) {
|
|
185
|
+
// Explicit FileBased — let any disk error bubble up.
|
|
186
|
+
return linearizeViaTempFile(pdfBytes, password);
|
|
187
|
+
}
|
|
188
|
+
// Automatic mode
|
|
189
|
+
if (canWriteToTemp()) {
|
|
190
|
+
try {
|
|
191
|
+
return yield linearizeViaTempFile(pdfBytes, password);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
console.warn(`Automatic Linearization: Disk attempt failed (${e.message}). ` +
|
|
195
|
+
"Falling back to Memory linearization.");
|
|
196
|
+
return linearizeInMemoryFromBytes(pdfBytes, password);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
console.warn("Automatic Linearization: No write permission detected. Using Memory linearization.");
|
|
200
|
+
return linearizeInMemoryFromBytes(pdfBytes, password);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
exports.linearizeCoreFromBytes = linearizeCoreFromBytes;
|
|
204
|
+
/**
|
|
205
|
+
* Variant of {@link linearizeCoreFromBytes} that starts from an open document on the engine.
|
|
206
|
+
* For {@link LinearizationMode.InMemory} we use the cheap document-id RPC; for the disk-based
|
|
207
|
+
* paths we have to fetch the bytes once and delegate to {@link linearizeCoreFromBytes}.
|
|
208
|
+
*/
|
|
209
|
+
function linearizeCoreFromId(id, getBytes, password = "", mode = render_1.LinearizationMode.Automatic) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
if (mode === render_1.LinearizationMode.InMemory) {
|
|
212
|
+
return linearizeInMemoryFromId(id, password);
|
|
213
|
+
}
|
|
214
|
+
const pdfBytes = yield getBytes();
|
|
215
|
+
return linearizeCoreFromBytes(pdfBytes, password, mode);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
exports.linearizeCoreFromId = linearizeCoreFromId;
|
|
219
|
+
/**
|
|
220
|
+
* Linearize via the engine's file-based RPC and persist the result through a client-side
|
|
221
|
+
* temporary file. The client-side disk write is the difference between this and
|
|
222
|
+
* {@link linearizeInMemoryFromBytes} — when the client filesystem is read-only,
|
|
223
|
+
* {@code FileBased} mode fails here so {@link LinearizationMode.Automatic} can fall back.
|
|
224
|
+
*
|
|
225
|
+
* Mirrors C# {@code PdfDocument.LinearizeViaTempFile}.
|
|
226
|
+
*/
|
|
227
|
+
function linearizeViaTempFile(pdfBytes, password) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
const linearized = yield saveAsLinearizedFromBytes(pdfBytes, "", password);
|
|
230
|
+
const tempPath = path.join(os.tmpdir(), `ironpdf-linearize-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}.pdf`);
|
|
231
|
+
try {
|
|
232
|
+
fs.writeFileSync(tempPath, linearized);
|
|
233
|
+
return fs.readFileSync(tempPath);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
try {
|
|
237
|
+
if (fs.existsSync(tempPath)) {
|
|
238
|
+
fs.unlinkSync(tempPath);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (_a) {
|
|
242
|
+
// best-effort cleanup
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Probe whether the current process can create files in the system temp directory.
|
|
249
|
+
*/
|
|
250
|
+
function canWriteToTemp() {
|
|
251
|
+
const probePath = path.join(os.tmpdir(), `ironpdf-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}.tmp`);
|
|
252
|
+
try {
|
|
253
|
+
fs.writeFileSync(probePath, "");
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
catch (_a) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
try {
|
|
261
|
+
if (fs.existsSync(probePath)) {
|
|
262
|
+
fs.unlinkSync(probePath);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (_b) {
|
|
266
|
+
// best-effort cleanup
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Linearize a PDF provided as raw bytes and save the result to disk via the file-based
|
|
272
|
+
* streaming {@code QPdf_Linearization_SaveAsLinearizedFromBytes} RPC.
|
|
273
|
+
*
|
|
274
|
+
* Mirrors the in-memory behavior used by {@link compressInMemory} in {@code compress.ts}:
|
|
275
|
+
* the engine streams the linearized bytes back, and we concatenate and persist them
|
|
276
|
+
* locally at {@code outputPath}.
|
|
277
|
+
*/
|
|
278
|
+
function saveAsLinearizedFromBytes(pdfBytes, outputPath, password = "") {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
const client = yield access_1.Access.ensureConnection();
|
|
281
|
+
return new Promise((resolve, reject) => {
|
|
282
|
+
const stream = client.QPdf_Linearization_SaveAsLinearizedFromBytes();
|
|
283
|
+
const buffers = [];
|
|
284
|
+
stream.on("data", (data) => {
|
|
285
|
+
if (data.exception) {
|
|
286
|
+
(0, util_1.handleRemoteException)(data.exception, reject);
|
|
287
|
+
}
|
|
288
|
+
else if (data.resultChunk) {
|
|
289
|
+
buffers.push(data.resultChunk);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
stream.on("error", (err) => {
|
|
293
|
+
reject(`${err.name}/n${err.message}`);
|
|
294
|
+
});
|
|
295
|
+
stream.on("end", () => {
|
|
296
|
+
resolve(buffer_1.Buffer.concat(buffers));
|
|
297
|
+
});
|
|
298
|
+
stream.write({
|
|
299
|
+
info: { outputPath: outputPath, password: password !== null && password !== void 0 ? password : "" },
|
|
300
|
+
});
|
|
301
|
+
(0, util_1.chunkBuffer)(pdfBytes).forEach((chunk) => {
|
|
302
|
+
stream.write({ pdfBytesChunk: chunk });
|
|
303
|
+
});
|
|
304
|
+
stream.end();
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
exports.saveAsLinearizedFromBytes = saveAsLinearizedFromBytes;
|
|
309
|
+
//# sourceMappingURL=linearize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linearize.js","sourceRoot":"","sources":["linearize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mCAA8B;AAC9B,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,mCAA6C;AAC7C,yCAAoC;AAapC,mDAAyD;AACzD,kCAA2D;AAE3D;;GAEG;AACH,SAAsB,qBAAqB,CAC1C,QAAgB,EAChB,QAAQ,GAAG,EAAE;;QAEb,MAAM,MAAM,GAAyB,MAAM,eAAM,CAAC,gBAAgB,EAAE,CAAC;QAErE,OAAO,IAAI,OAAO,CACjB,CAAC,OAA6B,EAAE,MAAkC,EAAE,EAAE;YACrE,MAAM,MAAM,GACX,MAAM,CAAC,+BAA+B,CACrC,CAAC,GAA6B,EAAE,KAAyC,EAAE,EAAE;;gBAC5E,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;iBACtC;qBAAM,IAAI,KAAK,EAAE;oBACjB,IAAI,KAAK,CAAC,SAAS,EAAE;wBACpB,IAAA,4BAAqB,EAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;wBAC/C,OAAO;qBACP;oBACD,OAAO,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,KAAK,CAAC,CAAC;iBAC/B;qBAAM;oBACN,MAAM,CAAC,iDAAiD,CAAC,CAAC;iBAC1D;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