pdf-parser.js 5.2.17 → 5.2.18
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.
|
@@ -176,15 +176,15 @@ function matchesAscii(bytes, offset, text) {
|
|
|
176
176
|
for (let i = 0; i < text.length; i++) if (bytes[offset + i] !== text.charCodeAt(i)) return false;
|
|
177
177
|
return true;
|
|
178
178
|
}
|
|
179
|
-
const TYPE1_CLEARTEXT_TERMINATOR = "eexec";
|
|
180
179
|
const PFB_SEGMENT_MARKER = 128;
|
|
181
180
|
const PFB_SEGMENT_HEADER_SIZE = 6;
|
|
182
|
-
const POSTSCRIPT_MAGIC = "%!";
|
|
183
181
|
function type1Sources(bytes) {
|
|
182
|
+
const cleartextTerminator = "eexec";
|
|
183
|
+
const postScriptMagic = "%!";
|
|
184
184
|
const start = bytes[0] === PFB_SEGMENT_MARKER ? PFB_SEGMENT_HEADER_SIZE : 0;
|
|
185
|
-
if (!matchesAscii(bytes, start,
|
|
185
|
+
if (!matchesAscii(bytes, start, postScriptMagic)) return;
|
|
186
186
|
let cleartextEnd = bytes.length;
|
|
187
|
-
for (let i = start; i + 5 <= bytes.length; i++) if (matchesAscii(bytes, i,
|
|
187
|
+
for (let i = start; i + 5 <= bytes.length; i++) if (matchesAscii(bytes, i, cleartextTerminator)) {
|
|
188
188
|
cleartextEnd = i;
|
|
189
189
|
break;
|
|
190
190
|
}
|
package/dist/builtin-encoding.js
CHANGED
|
@@ -175,15 +175,15 @@ function matchesAscii(bytes, offset, text) {
|
|
|
175
175
|
for (let i = 0; i < text.length; i++) if (bytes[offset + i] !== text.charCodeAt(i)) return false;
|
|
176
176
|
return true;
|
|
177
177
|
}
|
|
178
|
-
const TYPE1_CLEARTEXT_TERMINATOR = "eexec";
|
|
179
178
|
const PFB_SEGMENT_MARKER = 128;
|
|
180
179
|
const PFB_SEGMENT_HEADER_SIZE = 6;
|
|
181
|
-
const POSTSCRIPT_MAGIC = "%!";
|
|
182
180
|
function type1Sources(bytes) {
|
|
181
|
+
const cleartextTerminator = "eexec";
|
|
182
|
+
const postScriptMagic = "%!";
|
|
183
183
|
const start = bytes[0] === PFB_SEGMENT_MARKER ? PFB_SEGMENT_HEADER_SIZE : 0;
|
|
184
|
-
if (!matchesAscii(bytes, start,
|
|
184
|
+
if (!matchesAscii(bytes, start, postScriptMagic)) return;
|
|
185
185
|
let cleartextEnd = bytes.length;
|
|
186
|
-
for (let i = start; i + 5 <= bytes.length; i++) if (matchesAscii(bytes, i,
|
|
186
|
+
for (let i = start; i + 5 <= bytes.length; i++) if (matchesAscii(bytes, i, cleartextTerminator)) {
|
|
187
187
|
cleartextEnd = i;
|
|
188
188
|
break;
|
|
189
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-parser.js",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.18",
|
|
4
4
|
"description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on its own codec-owned LayoutDocument item model and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|