imprimatur 0.7.0-x86_64-linux-gnu → 0.8.1-x86_64-linux-gnu
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +23 -1
- data/lib/imprimatur/4.0/imprimatur-render-worker +0 -0
- data/lib/imprimatur/4.0/imprimatur_native.so +0 -0
- data/lib/imprimatur/pdf_reader.rb +3 -2
- data/lib/imprimatur/reader.rb +2 -2
- data/lib/imprimatur/version.rb +1 -1
- data/lib/imprimatur.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f633e6ff9c73538d14383925c761a1a06d19a5252b70b3b0351d1875696755b8
|
|
4
|
+
data.tar.gz: f098e38ba9eb17115703bcaa36a1621872392325721b6a90e028f4adaf39a368
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc99ae942f2a2c1ed48b1ebcdacd9cede4227137eb87407aa6d77da9332d96a7376c419a593a857d6d237b4961ec72c167f68c69920fd3e4f21b929d382c647b
|
|
7
|
+
data.tar.gz: 30c68466652b1260f8819df9eda7a924e6d7246514f871e3ef09077000e692c70ac7cbbcd87a335bcc1f3b462ef1e2e18528cfd95c72b74b62bbd693b75a22e8
|
data/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
- Allow a bounded exit grace when macOS cannot inspect an exiting worker;
|
|
12
12
|
persistent monitor failures still terminate and reap a live worker.
|
|
13
13
|
|
|
14
|
+
## [0.8.1](https://github.com/seuros/imprimatur/compare/v0.8.0...v0.8.1) (2026-10-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **pdf:** recover timeout neighbours within the overall deadline ([#16](https://github.com/seuros/imprimatur/issues/16)) ([e86fbbf](https://github.com/seuros/imprimatur/commit/e86fbbfef85f2c645090c43359c0744962e951a1))
|
|
20
|
+
* **pdf:** step timeout recovery so a Ruby wakeup cannot restart it ([75c3894](https://github.com/seuros/imprimatur/commit/75c3894c8a791c5ef4af562dc99de4e745770ad3))
|
|
21
|
+
|
|
22
|
+
## [0.8.0](https://github.com/seuros/imprimatur/compare/v0.7.0...v0.8.0) (2026-10-27)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **reader:** accept drop_repeated in the Ruby API ([4e537d6](https://github.com/seuros/imprimatur/commit/4e537d641bafd8d3cdb8b1c20d16f4cb766ad073))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **pdf:** read printed page numbers from headers too, not just footers ([c036434](https://github.com/seuros/imprimatur/commit/c0364341ee8fc36be2c97d25fd06da0aa76a4ad6))
|
|
33
|
+
|
|
14
34
|
## [0.7.0](https://github.com/seuros/imprimatur/compare/v0.6.1...v0.7.0) (2026-10-26)
|
|
15
35
|
|
|
16
36
|
|
data/README.md
CHANGED
|
@@ -32,7 +32,7 @@ end
|
|
|
32
32
|
gem "imprimatur"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Precompiled gems ship for Linux (x86_64 and aarch64, glibc 2.34+
|
|
35
|
+
Precompiled gems ship for Linux (x86_64 and aarch64, glibc 2.34+),
|
|
36
36
|
macOS 13+ (arm64, x86_64) and FreeBSD 15.1 (amd64): nothing to compile.
|
|
37
37
|
Anywhere else, the source gem compiles the extension on install, with the
|
|
38
38
|
toolchain from [rustup.rs](https://rustup.rs) (1.99+).
|
|
@@ -384,6 +384,28 @@ after metadata was read preserves completed pages and explicitly marks the
|
|
|
384
384
|
unreached pages; an expired overall deadline marks them `skipped`. Cancellation
|
|
385
385
|
still raises rather than returning a partial successful call.
|
|
386
386
|
|
|
387
|
+
For timeout-neighbour recovery, opt in to a shorter worker-attempt budget:
|
|
388
|
+
|
|
389
|
+
```ruby
|
|
390
|
+
Imprimatur.pdf_pages(bytes, timeout: 300, batch_timeout: 60)
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Here `timeout:` is the **overall** deadline, including recovery; `batch_timeout:`
|
|
394
|
+
caps the initial worker and each singleton retry. Completed pages survive a
|
|
395
|
+
batch timeout. Unread later neighbours are tried once before the first missing
|
|
396
|
+
page (which may have stalled the worker). Recovery is best effort, never an
|
|
397
|
+
extension of the overall deadline. Output-limit skips are not retried, and all
|
|
398
|
+
attempts share `max_output_bytes:`. Input, depth, process-memory and per-page
|
|
399
|
+
limits still apply; `max_inflated:` remains per worker/recovery attempt, not a
|
|
400
|
+
cumulative decompression allowance.
|
|
401
|
+
|
|
402
|
+
With `batch_timeout:` enabled, an explicit finite `timeout:` replaces the
|
|
403
|
+
ordinary 60-second process ceiling for this call; `timeout: nil` retains that
|
|
404
|
+
60-second ceiling. Both budgets must be positive; zero overall time still fails
|
|
405
|
+
immediately. Omitting `batch_timeout:` preserves the existing behaviour. Rust
|
|
406
|
+
callers can use `pages_isolated_recovering` with an explicit attempt duration
|
|
407
|
+
and overall `Limits`/`ProcessLimits`.
|
|
408
|
+
|
|
387
409
|
This is resource containment, **not a filesystem/network security sandbox**.
|
|
388
410
|
The raw crate `info`, `pages` and `render_page` APIs remain in-process;
|
|
389
411
|
`render_page` cannot interrupt Hayro.
|
|
Binary file
|
|
Binary file
|
|
@@ -11,8 +11,9 @@ module Imprimatur
|
|
|
11
11
|
|
|
12
12
|
def self.pages(document, first_page: 1, last_page: 0xFFFFFFFF, max_pages: 500,
|
|
13
13
|
max_page_bytes: 256 * 1024, max_output_bytes: 8 * 1024 * 1024,
|
|
14
|
-
memory_bytes: 1024 * 1024 * 1024, max_bytes: nil, **limits)
|
|
15
|
-
options = [first_page, last_page, max_pages, max_page_bytes, max_output_bytes
|
|
14
|
+
memory_bytes: 1024 * 1024 * 1024, max_bytes: nil, batch_timeout: nil, **limits)
|
|
15
|
+
options = [first_page, last_page, max_pages, max_page_bytes, max_output_bytes,
|
|
16
|
+
batch_timeout && Float(batch_timeout)]
|
|
16
17
|
JSON.parse(Native.pdf_pages(Reader.read(document, max_bytes), Reader.limits(max_bytes:, **limits),
|
|
17
18
|
options, RENDER_WORKER, memory_bytes),
|
|
18
19
|
symbolize_names: true)
|
data/lib/imprimatur/reader.rb
CHANGED
|
@@ -41,8 +41,8 @@ module Imprimatur
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
# @api private
|
|
44
|
-
def self.limits(timeout: 60, max_bytes: nil, max_inflated: nil)
|
|
45
|
-
[max_bytes, max_inflated, timeout && Float(timeout)]
|
|
44
|
+
def self.limits(timeout: 60, max_bytes: nil, max_inflated: nil, drop_repeated: false)
|
|
45
|
+
[max_bytes, max_inflated, timeout && Float(timeout), drop_repeated ? true : false]
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# A path or an IO is read no further than +max_bytes+ (one byte past it
|
data/lib/imprimatur/version.rb
CHANGED
data/lib/imprimatur.rb
CHANGED
|
@@ -72,6 +72,8 @@ module Imprimatur
|
|
|
72
72
|
# @param timeout [Numeric, nil] seconds the read may take (60), +nil+ for none
|
|
73
73
|
# @param max_bytes [Integer, nil] the largest document accepted (512 MiB)
|
|
74
74
|
# @param max_inflated [Integer, nil] decompressed bytes allowed in all (1 GiB)
|
|
75
|
+
# @param drop_repeated [Boolean] PDF only: drop text repeated at the same
|
|
76
|
+
# spot on most pages, anywhere on the page (watermarks); off by default
|
|
75
77
|
# @return [String] Markdown, UTF-8
|
|
76
78
|
# @raise [NoTextLayer] a PDF of scanned pages: run OCR instead
|
|
77
79
|
# @raise [PasswordRequired] a PDF that needs a password to open
|
|
@@ -113,6 +115,8 @@ module Imprimatur
|
|
|
113
115
|
# image count (nil when unknown), truncation flag and failure reason.
|
|
114
116
|
# Takes +first_page:+, +last_page:+, +max_pages:+ (500),
|
|
115
117
|
# +max_page_bytes:+ (256 KiB), +max_output_bytes:+ (8 MiB), and read limits.
|
|
118
|
+
# Optional +batch_timeout:+ caps each worker attempt; +timeout:+ then bounds
|
|
119
|
+
# the whole call, including one-pass recovery of timeout-unread neighbours.
|
|
116
120
|
# @return [Hash] +page_count:+, +encrypted:+ and +pages:+
|
|
117
121
|
def pdf_pages(document, ...) = PdfReader.pages(document, ...)
|
|
118
122
|
|