@build-qube/papyra 0.0.4 → 0.2.0

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.
Files changed (55) hide show
  1. package/README.md +129 -0
  2. package/dist/cache.d.ts +3 -0
  3. package/dist/cache.d.ts.map +1 -1
  4. package/dist/cache.js.map +1 -1
  5. package/dist/document.d.ts +251 -3
  6. package/dist/document.d.ts.map +1 -1
  7. package/dist/document.js +444 -16
  8. package/dist/document.js.map +1 -1
  9. package/dist/encode.d.ts +49 -0
  10. package/dist/encode.d.ts.map +1 -0
  11. package/dist/encode.js +71 -0
  12. package/dist/encode.js.map +1 -0
  13. package/dist/encoded.d.ts +91 -0
  14. package/dist/encoded.d.ts.map +1 -0
  15. package/dist/encoded.js +84 -0
  16. package/dist/encoded.js.map +1 -0
  17. package/dist/errors.d.ts +45 -0
  18. package/dist/errors.d.ts.map +1 -0
  19. package/dist/errors.js +69 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/fingerprint.d.ts +18 -0
  22. package/dist/fingerprint.d.ts.map +1 -0
  23. package/dist/fingerprint.js +48 -0
  24. package/dist/fingerprint.js.map +1 -0
  25. package/dist/index.d.ts +12 -2
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +5 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/links.d.ts +53 -0
  30. package/dist/links.d.ts.map +1 -0
  31. package/dist/links.js +26 -0
  32. package/dist/links.js.map +1 -0
  33. package/dist/outline.d.ts +72 -0
  34. package/dist/outline.d.ts.map +1 -0
  35. package/dist/outline.js +73 -0
  36. package/dist/outline.js.map +1 -0
  37. package/dist/runtime.d.ts +8 -0
  38. package/dist/runtime.d.ts.map +1 -1
  39. package/dist/runtime.js +2 -0
  40. package/dist/runtime.js.map +1 -1
  41. package/dist/scheduler.d.ts +20 -2
  42. package/dist/scheduler.d.ts.map +1 -1
  43. package/dist/scheduler.js +15 -0
  44. package/dist/scheduler.js.map +1 -1
  45. package/dist/search.d.ts +50 -0
  46. package/dist/search.d.ts.map +1 -0
  47. package/dist/search.js +151 -0
  48. package/dist/search.js.map +1 -0
  49. package/dist/text.d.ts +113 -0
  50. package/dist/text.d.ts.map +1 -0
  51. package/dist/text.js +84 -0
  52. package/dist/text.js.map +1 -0
  53. package/dist/types.d.ts +96 -0
  54. package/dist/types.d.ts.map +1 -1
  55. package/package.json +4 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,IAAI,cAAc,EAE3B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,gCAAgC;IAChC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,+EAA+E;AAC/E,MAAM,WAAW,IAAI;IACnB,mBAAmB;IACnB,QAAQ,CAAC,EA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AAK,EAAE,MAAM,GAAG,IAAI,CAOzD;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAWzD"}
package/dist/text.js ADDED
@@ -0,0 +1,84 @@
1
+ /** @internal */
2
+ export function toPageText(page, native) {
3
+ return {
4
+ page,
5
+ lines: native.lines,
6
+ undecodedGlyphs: native.undecodedGlyphs,
7
+ };
8
+ }
9
+ /** Every character on the page a search can see. */
10
+ export function pageString(text) {
11
+ return text.lines.map((line) => line.text).join('\n');
12
+ }
13
+ /** Roughly how much memory a page's text holds, for cache accounting. */
14
+ export function pageTextBytes(text) {
15
+ let bytes = 64;
16
+ for (const line of text.lines) {
17
+ bytes += line.text.length * 2 + line.offsets.byteLength + 48;
18
+ }
19
+ return bytes;
20
+ }
21
+ /**
22
+ * The quadrilateral covering `line`'s characters in `[start, end)`.
23
+ *
24
+ * Built from the baseline rather than from a stored rectangle, so rotated text — a
25
+ * drawing's vertical dimension labels, a sideways table header — gets a box at its own
26
+ * angle instead of an axis-aligned one that covers the wrong pixels.
27
+ */
28
+ export function lineQuad(line, start, end) {
29
+ const last = line.offsets.length - 1;
30
+ const from = line.offsets[clamp(start, 0, last)] ?? 0;
31
+ const to = line.offsets[clamp(end, 0, last)] ?? from;
32
+ // Rotating the baseline direction a quarter turn gives "up" — negative y, since the
33
+ // space has y increasing downwards.
34
+ const upX = line.dy;
35
+ const upY = -line.dx;
36
+ const ax = line.x + line.dx * from;
37
+ const ay = line.y + line.dy * from;
38
+ const bx = line.x + line.dx * to;
39
+ const by = line.y + line.dy * to;
40
+ return {
41
+ x0: ax + upX * line.ascent,
42
+ y0: ay + upY * line.ascent,
43
+ x1: bx + upX * line.ascent,
44
+ y1: by + upY * line.ascent,
45
+ x2: bx - upX * line.descent,
46
+ y2: by - upY * line.descent,
47
+ x3: ax - upX * line.descent,
48
+ y3: ay - upY * line.descent,
49
+ };
50
+ }
51
+ /** The smallest upright rectangle containing `quad`. */
52
+ export function quadBounds(quad) {
53
+ const xs = [quad.x0, quad.x1, quad.x2, quad.x3];
54
+ const ys = [quad.y0, quad.y1, quad.y2, quad.y3];
55
+ const x = Math.min(...xs);
56
+ const y = Math.min(...ys);
57
+ return { x, y, width: Math.max(...xs) - x, height: Math.max(...ys) - y };
58
+ }
59
+ /** Scale a rect from 72-DPI page space into a render's pixels. */
60
+ export function scaleRect(rect, scale) {
61
+ return {
62
+ x: rect.x * scale,
63
+ y: rect.y * scale,
64
+ width: rect.width * scale,
65
+ height: rect.height * scale,
66
+ };
67
+ }
68
+ /** Scale a quad from 72-DPI page space into a render's pixels. */
69
+ export function scaleQuad(quad, scale) {
70
+ return {
71
+ x0: quad.x0 * scale,
72
+ y0: quad.y0 * scale,
73
+ x1: quad.x1 * scale,
74
+ y1: quad.y1 * scale,
75
+ x2: quad.x2 * scale,
76
+ y2: quad.y2 * scale,
77
+ x3: quad.x3 * scale,
78
+ y3: quad.y3 * scale,
79
+ };
80
+ }
81
+ function clamp(value, low, high) {
82
+ return value < low ? low : value > high ? high : value;
83
+ }
84
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAoGA,gBAAgB;AAChB,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAsB;IAC7D,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,KAAyD;QACvE,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC,CAAC;AACJ,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,IA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AAK;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,KAAK;KAC5B,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,SAAS,CAAC,IAAU,EAAE,KAAa;IACjD,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY;IACrD,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACzD,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import type { MatchOptions } from './search.js';
1
2
  /** Anything we can turn into PDF bytes. `File` is a `Blob`, so it is covered. */
2
3
  export type PdfSource = Uint8Array | ArrayBuffer | ArrayBufferView | Blob;
4
+ /** How to size a render, and where it sits in the queue. */
3
5
  export interface RenderOptions {
4
6
  /**
5
7
  * Scheduling order. **Lower runs first**; the default, 0, is the most urgent tier.
@@ -25,6 +27,7 @@ export interface RenderOptions {
25
27
  */
26
28
  fitWidth?: number;
27
29
  }
30
+ /** {@link RenderOptions}, plus the two dials that only apply to a stream. */
28
31
  export interface StreamOptions extends RenderOptions {
29
32
  /**
30
33
  * How far ahead of consumption to queue. Defaults to the runtime's concurrency.
@@ -39,24 +42,93 @@ export interface StreamOptions extends RenderOptions {
39
42
  */
40
43
  order?: readonly number[];
41
44
  }
45
+ /**
46
+ * Options for {@link Document.renderSvg}. No `dpi` and no `fitWidth`: an SVG carries
47
+ * the page's own point dimensions and rasterises at whatever size it is drawn.
48
+ */
49
+ export interface SvgOptions {
50
+ /** Scheduling order, exactly as in {@link RenderOptions.priority}. */
51
+ priority?: number;
52
+ /** Abort a request that has not started yet. */
53
+ signal?: AbortSignal;
54
+ /**
55
+ * Defaults to `'white'`, matching how pages rasterise.
56
+ *
57
+ * Choose `'transparent'` when the SVG is going to be placed onto something else —
58
+ * an opaque rectangle behind vector artwork is the one thing a consumer cannot
59
+ * undo.
60
+ */
61
+ background?: 'white' | 'transparent';
62
+ }
42
63
  /** A rendered page. `data` is tightly packed RGBA8, `height * stride` bytes. */
43
64
  export interface RenderedPage {
65
+ /** Output width in pixels, after `dpi` or `fitWidth` was applied. */
44
66
  readonly width: number;
67
+ /** Output height in pixels. */
45
68
  readonly height: number;
69
+ /**
70
+ * Bytes per row. Always `width * 4` today, since the buffer is tightly packed —
71
+ * read it rather than recomputing it, so a future padded layout does not silently
72
+ * skew every row.
73
+ */
46
74
  readonly stride: number;
75
+ /** Always `'rgba8'`. Present so a second pixel layout could be added without a cast. */
47
76
  readonly format: 'rgba8';
77
+ /**
78
+ * The pixels, non-premultiplied RGBA.
79
+ *
80
+ * On wasm this view is backed by the module's shared linear memory, which is why
81
+ * {@link toImageData} and `Blob` construction copy rather than borrow.
82
+ */
48
83
  readonly data: Uint8Array;
49
84
  }
85
+ /** One result from {@link Document.stream}, tagged with the page it came from. */
50
86
  export interface StreamedPage {
51
87
  /** Index of the page in the document. */
52
88
  readonly page: number;
89
+ /** The rendered pixels. */
53
90
  readonly bitmap: RenderedPage;
54
91
  }
55
92
  /** Page dimensions in PDF points (1/72 inch). */
56
93
  export interface PageSize {
94
+ /** Width in points, with rotation and the crop box already applied. */
57
95
  readonly width: number;
96
+ /** Height in points, with rotation and the crop box already applied. */
58
97
  readonly height: number;
59
98
  }
99
+ /**
100
+ * The document information dictionary — what the file says about itself.
101
+ *
102
+ * Every field is independently optional, and a field the document left blank reads as
103
+ * `null` rather than an empty string. None of it is verified: a producer writes what
104
+ * it likes, and `title` in particular is frequently a filename or absent entirely, so
105
+ * a viewer showing a document name should fall back to its own.
106
+ */
107
+ export interface DocumentMetadata {
108
+ /** The document's own title, which is frequently a filename or absent. */
109
+ readonly title: string | null;
110
+ /** Who the document claims to be by. */
111
+ readonly author: string | null;
112
+ /** A one-line description. Rare outside of published documents. */
113
+ readonly subject: string | null;
114
+ /** Free text, and not reliably a delimited list — producers use commas or spaces. */
115
+ readonly keywords: string | null;
116
+ /** The application the document was authored in, e.g. `AutoCAD`. */
117
+ readonly creator: string | null;
118
+ /** The application that wrote the PDF, e.g. `Ghostscript`. */
119
+ readonly producer: string | null;
120
+ /**
121
+ * When the document was created, as an ISO 8601 string — `new Date(created)` parses
122
+ * it directly.
123
+ *
124
+ * A PDF date may be as short as a year, in which case the missing components read
125
+ * as January 1st. It is also self-reported, and clocks lie.
126
+ */
127
+ readonly created: string | null;
128
+ /** When the document was last modified, ISO 8601. */
129
+ readonly modified: string | null;
130
+ }
131
+ /** Everything fixed for the lifetime of a {@link Document}: its queue and its caches. */
60
132
  export interface OpenOptions {
61
133
  /** Password for an encrypted document. */
62
134
  password?: string;
@@ -87,5 +159,29 @@ export interface OpenOptions {
87
159
  * `renderPages` is a throughput API and would evict everything useful in one call.
88
160
  */
89
161
  cacheBytes?: number;
162
+ /**
163
+ * Bytes of extracted page text to keep. Defaults to 32 MB; `0` disables it.
164
+ *
165
+ * Text is three orders of magnitude smaller than the same page's pixels — a dense
166
+ * page of a paper is ~80 KB against ~11 MB — so the default holds hundreds of pages
167
+ * and a repeated search never re-extracts one.
168
+ */
169
+ textCacheBytes?: number;
170
+ }
171
+ /** Options for {@link Document.search}. */
172
+ export interface SearchOptions extends MatchOptions {
173
+ /**
174
+ * Pages to search, in order. Defaults to every page from the first.
175
+ *
176
+ * A viewer wants to search outward from the page on screen: the nearest hit is
177
+ * almost never on page 1, and the first result is usually the one being looked for.
178
+ */
179
+ order?: readonly number[];
180
+ /** Stop after this many matches. */
181
+ limit?: number;
182
+ /** Where text extraction sits in the render queue. Defaults to behind rendering. */
183
+ priority?: number;
184
+ /** Abort the search. Pages already being extracted are left to finish. */
185
+ signal?: AbortSignal;
90
186
  }
91
187
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,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,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@build-qube/papyra",
3
- "version": "0.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "Fast PDF rendering for Node and the browser, powered by Rust",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,10 +36,11 @@
36
36
  "build": "tsc -p tsconfig.json",
37
37
  "typecheck": "tsc -p tsconfig.json --noEmit",
38
38
  "clean": "rm -rf dist *.tsbuildinfo",
39
- "test": "bun test"
39
+ "test": "bun test test/unit",
40
+ "test:integration": "bun test test/integration"
40
41
  },
41
42
  "dependencies": {
42
- "@build-qube/papyra-native": "0.0.4"
43
+ "@build-qube/papyra-native": "0.2.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "typescript": "^7.0.2"