imprimatur 0.7.0-aarch64-linux-gnu → 0.8.1-aarch64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acbd72cb878ab5b6919bbc5ad03997eeeebeffd701dfc14f6d2c5148fc0097a3
4
- data.tar.gz: 5386038c1564866f29bb1fd0bdeeb0997b53ff71ebc5b49633c2446bc6d10575
3
+ metadata.gz: 8e45880f6944a007234ce99fb196f9421b0c6ff4d852b3a2db4d9920033db620
4
+ data.tar.gz: 6cb5da186f0be53df0b38e2e8cf637c8c6f3bd4a0f2c8a71129a9b9e738e491f
5
5
  SHA512:
6
- metadata.gz: a2c84c0c17ba5a2f70b78c9d3167c2dab1bf5b73482ea6d148ebd84bc8bb8f6e3e9a598d6e6c64525729ecbd35964104964dbb54e70439c44957893d2ca116a6
7
- data.tar.gz: bd629f569080f23bba0cee8f15d2f354ae25bec4ae1e1d2967391f123154318cffdd771a9fe49af7c68f8058754639c1d940613c5f1a6307e3463aead34f8c42
6
+ metadata.gz: 4b38abf70340c6fb1c707aca033d30318460199e7f14b2f2af97a61b86ef6e79c59f86dd6df666bac2c9b3c226d43cb7fe379c76c2c515b2e618ccc390a6f224
7
+ data.tar.gz: cd17aace372ea781e79aef328a0e542e4e8c4c4a0b71fa4fc4d5d19a2bcf319b186beb9cc9bd2f540fae87b4b5a9d850dac9360b4ab165e51cd722a4985f4cf9
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+ and musl),
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.
@@ -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)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Imprimatur
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.1'
5
5
  end
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imprimatur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Abdelkader Boudih