@parseo/appraisals 1.0.2 → 1.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"extract-checkboxes.d.ts","sourceRoot":"","sources":["../../src/form-1004mc/extract-checkboxes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,CAAC,EAAE,MAAM,CAAC;IACV,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,EAAE,CAAC,CAgG5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,eAAe,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACvC,UAAU,SAAI,GACb,MAAM,CAWR"}
1
+ {"version":3,"file":"extract-checkboxes.d.ts","sourceRoot":"","sources":["../../src/form-1004mc/extract-checkboxes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,CAAC,EAAE,MAAM,CAAC;IACV,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,EAAE,CAAC,CAqG5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,eAAe,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACvC,UAAU,SAAI,GACb,MAAM,CAWR"}
@@ -62,23 +62,30 @@ export async function extractCheckedBoxes(buffer, pageNum) {
62
62
  continue;
63
63
  }
64
64
  if (name === "constructPath") {
65
- const [opcodes, pathArgs] = args;
66
- let ai = 0;
65
+ // pdfjs-dist v5: args = [paintOp, [Float32Array], bounds]
66
+ // Float32Array is interleaved [subOp, coords...] where:
67
+ // 0=moveTo(x,y), 1=lineTo(x,y), 2=curveTo(6 coords), 4=closePath
68
+ const pathData = args[1]?.[0];
69
+ if (!(pathData instanceof Float32Array))
70
+ continue;
67
71
  const points = [];
68
- for (const op of opcodes) {
69
- if (op === 13 /* moveTo */ || op === 14 /* lineTo */) {
70
- const px = pathArgs[ai++];
71
- const py = pathArgs[ai++];
72
+ let ai = 0;
73
+ while (ai < pathData.length) {
74
+ const op = pathData[ai];
75
+ if (op === 0 /* moveTo */ || op === 1 /* lineTo */) {
76
+ const px = pathData[ai + 1];
77
+ const py = pathData[ai + 2];
72
78
  points.push(applyM(ctm, px, py));
79
+ ai += 3;
80
+ }
81
+ else if (op === 2 /* curveTo */) {
82
+ ai += 7;
73
83
  }
74
- else if (op === 19 /* rectangle */) {
75
- const rx = pathArgs[ai++], ry = pathArgs[ai++];
76
- const rw = pathArgs[ai++], rh = pathArgs[ai++];
77
- points.push(applyM(ctm, rx, ry));
78
- points.push(applyM(ctm, rx + rw, ry + rh));
84
+ else if (op === 4 /* closePath */) {
85
+ ai += 1;
79
86
  }
80
- else if (op === 18 /* closePath */) {
81
- // no args
87
+ else {
88
+ ai += 1;
82
89
  }
83
90
  }
84
91
  if (points.length >= 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parseo/appraisals",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,6 +11,13 @@
11
11
  }
12
12
  },
13
13
  "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/PabloZimmermann/parseo",
17
+ "directory": "packages/appraisals"
18
+ },
19
+ "homepage": "https://github.com/PabloZimmermann/parseo#readme",
20
+ "bugs": "https://github.com/PabloZimmermann/parseo/issues",
14
21
  "publishConfig": {
15
22
  "access": "public"
16
23
  },
@@ -23,6 +30,6 @@
23
30
  "build": "tsc"
24
31
  },
25
32
  "dependencies": {
26
- "@parseo/shared": "1.0.2"
33
+ "@parseo/shared": "1.0.3"
27
34
  }
28
35
  }