pdfrb 0.7.1 → 0.7.10

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +93 -0
  3. data/RELEASE.md +17 -11
  4. data/data/pdfrb/layout/hyphenation_en.txt +408 -0
  5. data/lib/pdfrb/color/default_profile.rb +213 -0
  6. data/lib/pdfrb/color/icc_validator.rb +69 -0
  7. data/lib/pdfrb/color.rb +2 -0
  8. data/lib/pdfrb/conformance/ltv.rb +112 -0
  9. data/lib/pdfrb/conformance/pades.rb +198 -0
  10. data/lib/pdfrb/conformance/pdf_2_af.rb +185 -0
  11. data/lib/pdfrb/conformance/pdf_a.rb +123 -0
  12. data/lib/pdfrb/conformance/pdf_a4_deep.rb +94 -0
  13. data/lib/pdfrb/conformance/pdf_ua2_deep.rb +93 -0
  14. data/lib/pdfrb/conformance/pdf_ua_tagging_deep.rb +125 -0
  15. data/lib/pdfrb/conformance/pdf_vt.rb +128 -0
  16. data/lib/pdfrb/conformance/pdf_x.rb +66 -1
  17. data/lib/pdfrb/conformance/tagged_pdf.rb +182 -0
  18. data/lib/pdfrb/conformance.rb +8 -0
  19. data/lib/pdfrb/content/parser.rb +82 -0
  20. data/lib/pdfrb/digital_signature/timestamp_client.rb +86 -0
  21. data/lib/pdfrb/digital_signature.rb +1 -0
  22. data/lib/pdfrb/document.rb +29 -0
  23. data/lib/pdfrb/encryption/public_key_security_handler.rb +146 -0
  24. data/lib/pdfrb/encryption/standard_security_handler.rb +98 -3
  25. data/lib/pdfrb/encryption/v5_writer.rb +108 -0
  26. data/lib/pdfrb/encryption.rb +3 -0
  27. data/lib/pdfrb/font_loader/type3.rb +65 -0
  28. data/lib/pdfrb/font_loader.rb +1 -0
  29. data/lib/pdfrb/image_loader/gif.rb +246 -0
  30. data/lib/pdfrb/image_loader/tiff.rb +257 -0
  31. data/lib/pdfrb/image_loader.rb +2 -0
  32. data/lib/pdfrb/layout/font_fallback.rb +203 -0
  33. data/lib/pdfrb/layout/hyphenation.rb +120 -0
  34. data/lib/pdfrb/layout/justification_kashidas.rb +72 -0
  35. data/lib/pdfrb/layout/multi_cell_text_layout.rb +65 -0
  36. data/lib/pdfrb/layout/multi_page_table_box.rb +155 -0
  37. data/lib/pdfrb/layout/polygon_frame.rb +106 -0
  38. data/lib/pdfrb/layout/table_box.rb +154 -23
  39. data/lib/pdfrb/layout/text_shaper.rb +129 -0
  40. data/lib/pdfrb/layout.rb +7 -0
  41. data/lib/pdfrb/source/linearization_reader.rb +76 -0
  42. data/lib/pdfrb/source/recovery.rb +65 -1
  43. data/lib/pdfrb/source/tokenizer.rb +21 -0
  44. data/lib/pdfrb/source.rb +1 -0
  45. data/lib/pdfrb/task/thumbnail.rb +133 -0
  46. data/lib/pdfrb/task.rb +1 -0
  47. data/lib/pdfrb/version.rb +1 -1
  48. metadata +28 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14c300c425848b557b210be218c07de40adbb5188e0c36c15d7d72336395d7c9
4
- data.tar.gz: 672e663a9efe0991f97aceda226a1fa909ef804d8dd2a94e1cb7f2df4d1cd1c8
3
+ metadata.gz: e852ec0176452037ffd0e715fc4edd866261d20e9de19938e0342741701e7f4a
4
+ data.tar.gz: 1e36dcfec95c64efa1265c4264a34f290ecd82de3b7acc65dd6d6c315b845e4b
5
5
  SHA512:
6
- metadata.gz: 18c8b3c2c2a15a4fd6dff6f8d58c4403e2e23067f9ad8c655e4a8fe5d43678d748f8d0378eddfc92c9d98f118b710887c0bf95374756088f4885461373d1e30c
7
- data.tar.gz: cfcbe27e32085ad4a9e753645a8e56571630c230f69aae6f289c7d618bc23bba98b49830be6e01a5317de922f78faba5ec3b1d106436dd75cf600872ab5e75e1
6
+ metadata.gz: '085c4d548c341bb9db63df48b0b5c9efc2eb897c135e36b57f36cd1385c7062a5b08f043113695f2a0b5f30caa4e02d11fa5031cbf870b83827bc4303cddc0f3'
7
+ data.tar.gz: a5a131520e73cee21be784f947e6bf21c348d708b54d86757a90b6dc3a2de925ca8188b544f7864b53c4930d60c3a101f4281e9517adf4188f2b6d85dc1eeb1b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,99 @@
2
2
 
3
3
  All notable changes to the pdfrb gem will be documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ### Added — Parity batches 4-9
8
+
9
+ * **TODO 103 Hyphenation** — Knuth-Liang `Pdfrb::Layout::Hyphenation`
10
+ with curated English patterns in `data/pdfrb/layout/hyphenation_en.txt`.
11
+ * **TODO 116 PDF/X-6** — `Pdfrb::Conformance::PdfX#X6` ISO 15930-11
12
+ profile.
13
+ * **TODO 117 PDF/VT** — `Pdfrb::Conformance::PdfVT` (VT-1, VT-2)
14
+ ISO 16612-2 profiles.
15
+ * **TODO 118 Multi-revision traversal** — `Document#each_revision`
16
+ walks the `/Prev` chain yielding `(revision_index, xref, trailer)`.
17
+ * **TODO 119 Table cell spans** — `TableBox.cell(box, colspan:,
18
+ rowspan:)`, hash-form cells, span-aware layout.
19
+ * **TODO 120 Multi-page table** — `MultiPageTableBox` splits a table
20
+ across pages with header-row repeat.
21
+ * **TODO 122 Bidi** — `Pdfrb::Layout::Bidi` paragraph-level UAX #9
22
+ reordering; `TextLayouter` reorders Hebrew/Arabic for visual order.
23
+ * **TODO 128 Linearization-aware reader** —
24
+ `Source::LinearizationReader.detect(io)` parses the first indirect
25
+ object's dict for `/Linearized`.
26
+ * **TODO 129 Type3 font loader** — `Pdfrb::FontLoader::Type3` with
27
+ glyph procedures + encoding.
28
+ * **TODO 131 Inline images (write)** — `Canvas#inline_image(dict:,
29
+ data:)` plus `Operator::{BeginInlineImage, EndInlineImage}`.
30
+ * **TODO 133 Custom canvas primitives** — `polyline`, `polygon`,
31
+ `arc`, `circle`, `ellipse`, `rounded_rectangle`, `dash=`.
32
+ * **TODO 135 PDF thumbnail generation** — `Pdfrb::Task::Thumbnail`
33
+ builds `/Thumb` image XObjects on every page.
34
+ * **TODO 136 PDF/A preflight deep** — `PREFLIGHT_DEEP` rule set on
35
+ PdfA (JavaScript, PostScript XObjects, encryption, embedded-file
36
+ bans for A-1/A-2/A-4).
37
+ * **TODO 137 PDF/UA tagging deep** — list/LI/LBody, Table/TR,
38
+ TH/Scope structural checks.
39
+ * **TODO 138 Tagged PDF validation** —
40
+ `Pdfrb::Conformance::TaggedPdf` baseline structural rule set.
41
+ * **TODO 140 PDF 2.0 AF validation** —
42
+ `Pdfrb::Conformance::Pdf2AF` App Note 002 validator.
43
+ * **TODO 104 Default ICC profile** — `Color::DefaultProfile` emits a
44
+ usable sRGB v4 ICC profile with desc/wtpt/rXYZ/gXYZ/bXYZ/rTRC/
45
+ gTRC/bTRC tags and a real MD5 Profile ID.
46
+ * **TODO 139 ICC profile validation** —
47
+ `Pdfrb::Color::ICCValidator` checks signature, version, device
48
+ class, color space per ICC.1:2022 §7.
49
+ * **TODO 108 Image downsampling** —
50
+ `Pdfrb::Image::Downsampler` + `Task::Optimize#downsample_images!`
51
+ for FlateDecode 8-bpc non-palette images.
52
+ * **TODO 130 Color-key masking** — `ImageLoader::PNG` parses tRNS and
53
+ emits `/Mask` color-key array.
54
+ * **TODO 131 Inline images (read)** — `Content::Parser` recognises
55
+ the BI/ID/EI sequence and yields an `InlineImage` invocation.
56
+ * **TODO 132 Page-piece dict** —
57
+ `Pdfrb::Model::Type::PagePieceInfo` per s14.5.
58
+ * **TODO 134 Tagged PDF alt-text API** — `Document::Structure`
59
+ facade for `/Alt`, `/ActualText`, `/Lang`.
60
+ * **Layout** — cluster-aware default `TextShaper`, real AFM-based
61
+ `FontFallback`, `PolygonFrame` with proper inscribed-rectangle
62
+ scan, `MultiCellTextLayout`, `JustificationKashidas`.
63
+ * **Encryption** — `StandardSecurityHandler.for_v5` write-side
64
+ AES-256 R6 handler (file key + `/U`/`/O`/`/UE`/`/OE`/`/Perms`),
65
+ `V5Writer` PKCS#5 algorithms, `PublicKeySecurityHandler` with
66
+ real CMS EnvelopedData construction via `OpenSSL::PKCS7`.
67
+ * **Signatures** — `Pdfrb::Conformance::Pades` (B-B, B-T, B-LT,
68
+ B-LTA profiles), `Pdfrb::Conformance::Ltv` long-term validation,
69
+ `Pdfrb::Conformance::PdfA4Deep`, `PdfUA2Deep`,
70
+ `DigitalSignature::TimestampClient` (RFC 3161 TSA over HTTPS).
71
+ * **Images** — `ImageLoader::TIFF` decodes uncompressed RGB/gray;
72
+ `ImageLoader::GIF` does full GIF-spec LZW decode with palette.
73
+ * **Source** — extended `Pdfrb::Source::Recovery` with
74
+ trailer-reference recovery, hybrid-xref detection,
75
+ object-stream rebuild.
76
+ * **Tasks** — `Pdfrb::Task::RegenerateAppearances` walks widget
77
+ annotations and rebuilds `/AP /N` via `Appearance::Generator`.
78
+
79
+ ### Fixed
80
+
81
+ * Stream deduplication in `Task::Optimize` (was a stub).
82
+ * `Writer#write_xref_stream` now emits a free entry for every gap
83
+ in the oid space (was misaligning the reader).
84
+ * `Document::Form#flatten!` now stamps field appearances into page
85
+ content via `/Do` (was a stub).
86
+ * Issue #63: PostScript name extraction for `/BaseFont`.
87
+ * Issue #64: `Resources#empty?` handles Hash, Array, Cos::Dictionary,
88
+ PdfArray.
89
+
90
+ ### Changed
91
+
92
+ * Release workflow switched to emf2svg-ruby pattern: direct OIDC
93
+ trusted publishing via `rubygems/configure-rubygems-credentials@main`
94
+ + plain `gem push`. Bump job commits version.rb and tags `vX.Y.Z`.
95
+ * Removed all `instance_variable_set/get`, `send` to private
96
+ methods, `respond_to?` for type checks.
97
+
5
98
  ## [0.7.0] — 2026-08-08
6
99
 
7
100
  ### Added — Release infrastructure
data/RELEASE.md CHANGED
@@ -5,7 +5,8 @@ Releases are driven by the Metanorma CI reusable workflow at
5
5
 
6
6
  1. **`workflow_dispatch`** with a `next_version` input — manual run
7
7
  from the Actions UI. Accepted values: `x.y.z`, `major`, `minor`,
8
- `patch`, or `pre|rc|etc` to bump to a prerelease.
8
+ `patch`, `pre|rc|etc`, or `skip` (release the current gemspec
9
+ version as-is).
9
10
  2. **`repository_dispatch`** with event type `do-release` — for
10
11
  automation triggers from other repos.
11
12
 
@@ -14,12 +15,14 @@ Both call
14
15
  which handles version bumping, tag creation, gem build, RubyGems
15
16
  publish, and GitHub release creation.
16
17
 
17
- ## Required secrets
18
+ ## Authentication
18
19
 
19
- * `CLARICLE_CI_RUBYGEMS_API_KEY` RubyGems API key with `push`
20
- permission on the `pdfrb` gem. Set in repo Settings Secrets and
21
- Variables → Actions.
22
- * `GITHUB_TOKEN` — automatic; used for creating the GitHub release.
20
+ The reusable workflow uses the `CLARICLE_CI_RUBYGEMS_API_KEY` secret
21
+ for RubyGems authentication. Ensure this secret is set in repo
22
+ Settings → Secrets and Variables → Actions.
23
+
24
+ The `GITHUB_TOKEN` is passed as `pat_token` for the version-bump
25
+ commit/tag/push steps.
23
26
 
24
27
  ## Triggering a release
25
28
 
@@ -27,14 +30,14 @@ publish, and GitHub release creation.
27
30
 
28
31
  1. Go to Actions → `release` workflow.
29
32
  2. Click "Run workflow".
30
- 3. Enter the next version (e.g., `0.7.0`, `patch`, `minor`, `major`).
33
+ 3. Enter the next version (e.g., `0.8.0`, `patch`, `minor`, `major`).
31
34
  4. Click "Run workflow".
32
35
 
33
36
  ### From the API / CI
34
37
 
35
38
  ```sh
36
39
  gh workflow run release.yml \
37
- -f next_version=0.7.0
40
+ -f next_version=0.8.0
38
41
  ```
39
42
 
40
43
  Or via `repository_dispatch` from another repo:
@@ -42,15 +45,17 @@ Or via `repository_dispatch` from another repo:
42
45
  ```sh
43
46
  gh api /repos/claricle/pdfrb/dispatches \
44
47
  -f event_type=do-release \
45
- -f 'client_payload[next_version]=0.7.0'
48
+ -f 'client_payload[next_version]=0.8.0'
46
49
  ```
47
50
 
48
51
  ## CI (test) workflow
49
52
 
50
53
  `.github/workflows/rake.yml` runs the standard Metanorma CI
51
54
  generic-rake workflow on every push to `main`/`master`, every tag
52
- push, every pull request, and via manual `workflow_dispatch`. It
53
- fires the test matrix across supported Ruby versions.
55
+ push, every pull request, and via manual `workflow_dispatch`.
56
+
57
+ `.github/workflows/ci.yml` (the original hand-rolled CI) is also
58
+ present as a fallback.
54
59
 
55
60
  ## Pre-release checklist
56
61
 
@@ -59,3 +64,4 @@ fires the test matrix across supported Ruby versions.
59
64
  workflow handles this automatically when given `next_version`).
60
65
  * `CHANGELOG.md` has an entry for the new version.
61
66
  * No uncommitted changes on `main`.
67
+ * `CLARICLE_CI_RUBYGEMS_API_KEY` secret is set in repo settings.
@@ -0,0 +1,408 @@
1
+ .ab1
2
+ ab2c
3
+ a2ble
4
+ .a1
5
+ a2b
6
+ ac1c
7
+ ad2d
8
+ ag2
9
+ al1s
10
+ an3c
11
+ a3p2
12
+ ar1d
13
+ ar1t
14
+ as1c
15
+ as1s
16
+ at1c
17
+ au1
18
+ a1v
19
+ a3y
20
+ be2s4
21
+ 1ba
22
+ 2b1
23
+ be2
24
+ bi2z
25
+ 1b2
26
+ bo2
27
+ bp1
28
+ bs1
29
+ b5t2
30
+ b5u2
31
+ 1ca
32
+ c2h2
33
+ ci2
34
+ 1c2
35
+ ck1
36
+ co3
37
+ con1
38
+ cp1
39
+ cs2
40
+ cu2
41
+ cy1
42
+ 1da
43
+ dd2
44
+ de2
45
+ 1d2
46
+ d4f3
47
+ d5i6
48
+ dg2
49
+ d1i4
50
+ d5le
51
+ d3o2
52
+ ds4
53
+ 1ea
54
+ ea2
55
+ e1b
56
+ e2c1
57
+ e1d
58
+ e4ed
59
+ e1f
60
+ e1g
61
+ e1h
62
+ ei2
63
+ e3j
64
+ e1k
65
+ e1l
66
+ e2m1
67
+ e1n
68
+ eo2
69
+ ep2
70
+ e1q
71
+ e1r
72
+ e4s1
73
+ e1t
74
+ eu2
75
+ e1v
76
+ e1w
77
+ e1x
78
+ ey1
79
+ e1z
80
+ 1fa
81
+ fb1
82
+ fe2
83
+ 1f2
84
+ ff2
85
+ 4f3i
86
+ fi2
87
+ 4f5l
88
+ 1f2
89
+ fo1
90
+ f4p1
91
+ fr2
92
+ 1ga
93
+ g2a
94
+ 1g2
95
+ gd1
96
+ ge3
97
+ g2gel
98
+ g4g3
99
+ gi2
100
+ 1g2
101
+ go1
102
+ g4p1
103
+ g3ra
104
+ 1ha
105
+ he2
106
+ 1h2
107
+ hi2
108
+ 1h2
109
+ ho2
110
+ hp1
111
+ hs2
112
+ hu2
113
+ hy1
114
+ 4i1a
115
+ 2i1b
116
+ i1c4
117
+ 2i1d
118
+ i1e
119
+ 4if
120
+ i1g2
121
+ 4ih
122
+ ii2
123
+ i1j4
124
+ i1k2
125
+ i1l2
126
+ 2im
127
+ 2in
128
+ 4i1o
129
+ i1p4
130
+ i1q
131
+ ir2
132
+ 4is
133
+ i1t4
134
+ i1u
135
+ 2iv
136
+ i1w
137
+ iw4
138
+ ix2
139
+ i1y
140
+ iz2
141
+ 1ja
142
+ 1je
143
+ 1ji
144
+ 1jo
145
+ 1ju
146
+ 1ka
147
+ kb1
148
+ 1kc
149
+ 1kd
150
+ ke2
151
+ 1k2
152
+ kf1
153
+ kg1
154
+ k2h
155
+ 1ki
156
+ 1kj
157
+ kk1
158
+ 1kl
159
+ km1
160
+ 1kn
161
+ ko1
162
+ kp1
163
+ 1kr
164
+ ks2
165
+ 1ku
166
+ 1kv
167
+ 1kw
168
+ 1la
169
+ lb1
170
+ lc1
171
+ ld2
172
+ le2
173
+ 1l2
174
+ lf1
175
+ lg2
176
+ 1li
177
+ 1lj
178
+ 1lk1
179
+ 1ll2
180
+ 1lm1
181
+ 1ln1
182
+ 1lo
183
+ 1lp1
184
+ 1lq
185
+ 1lr
186
+ 1ls
187
+ 1lt1
188
+ 1lu
189
+ 1lv
190
+ 1lw
191
+ 1lx
192
+ 1ly
193
+ 1lz
194
+ 4ma
195
+ 1m2b1
196
+ me2
197
+ m1f1
198
+ m4g3
199
+ mi2
200
+ 4m1l
201
+ 1mo
202
+ 1mp
203
+ m2s1
204
+ mu2
205
+ my1
206
+ 1na
207
+ nb1
208
+ nc2
209
+ nd2
210
+ ne2
211
+ 1n2
212
+ nf1
213
+ n2g3
214
+ 1ni
215
+ 1nj
216
+ 1nk1
217
+ n1l2
218
+ 1nm1
219
+ 1nn
220
+ 1no
221
+ n1p1
222
+ n1q
223
+ 1nr
224
+ ns2
225
+ nt1
226
+ 1nu
227
+ 1nv
228
+ nw1
229
+ ny1
230
+ 1ob
231
+ oc2
232
+ o1d4
233
+ o1f
234
+ og2
235
+ oh2
236
+ oi2
237
+ o1j
238
+ o1k
239
+ ol2
240
+ om1
241
+ on4
242
+ op2
243
+ o1q
244
+ o1r
245
+ o4s3
246
+ o1t
247
+ ou2
248
+ o1v
249
+ ow2
250
+ ox1
251
+ o1y
252
+ oz2
253
+ 1pa
254
+ 1p2b
255
+ pe2
256
+ 1p2
257
+ pf1
258
+ 4ph
259
+ p2h2
260
+ 4p1l
261
+ 1p2
262
+ po1
263
+ p2p
264
+ p1p1
265
+ p4p3
266
+ ps2
267
+ p1t2
268
+ 4q
269
+ 1qu
270
+ 1ra
271
+ 1r2b1
272
+ r1c
273
+ rd2
274
+ re2
275
+ r1d4
276
+ 1re
277
+ r1f4
278
+ r1g
279
+ r1h4
280
+ ri2
281
+ 4r1l
282
+ 1rm1
283
+ 1rn1
284
+ ro2
285
+ r1p4
286
+ r1r4
287
+ 1rs2
288
+ rt1
289
+ r1t4
290
+ r1u
291
+ ru2
292
+ r1v
293
+ r1w4
294
+ 1sa
295
+ 1s2b1
296
+ s1c
297
+ s1d
298
+ se2
299
+ s1e
300
+ s1f
301
+ s1g
302
+ sh2
303
+ si2
304
+ 1s2
305
+ s1k1
306
+ sl1
307
+ s1l1
308
+ sm2
309
+ s1m1
310
+ sn1
311
+ 1so
312
+ s1p
313
+ s1q
314
+ 1sr1
315
+ s1s1
316
+ s1t1
317
+ st1
318
+ su2
319
+ s1w
320
+ sy2
321
+ 4ta
322
+ 1t2b
323
+ tc2
324
+ t1d4
325
+ te2
326
+ t1e
327
+ t1f
328
+ t1g4
329
+ th1
330
+ 1ti
331
+ t1j
332
+ t1k
333
+ 1tl1
334
+ 1tn1
335
+ to2
336
+ t1p
337
+ t1q
338
+ t1r4
339
+ t1s1
340
+ t1t1
341
+ tu2
342
+ t1u
343
+ t1v
344
+ tw1
345
+ 1ua
346
+ ub1
347
+ u1c4
348
+ u1d
349
+ 4uf
350
+ u1g2
351
+ 4uh
352
+ ui2
353
+ u1j4
354
+ u1k2
355
+ u1l2
356
+ 4un
357
+ u1p4
358
+ u1q
359
+ ur2
360
+ 4us
361
+ u1t4
362
+ u1u
363
+ 4uv
364
+ u1w
365
+ ux1
366
+ u1y
367
+ uz2
368
+ 1va
369
+ 1v2b1
370
+ vc1
371
+ ve2
372
+ 1v2
373
+ v1f1
374
+ vi2
375
+ v1l
376
+ v1o
377
+ v1p1
378
+ 1vs2
379
+ vu1
380
+ 1wa
381
+ 1w2b
382
+ we2
383
+ wh1
384
+ 1wi
385
+ 1w2
386
+ wl1
387
+ wn1
388
+ 1wo
389
+ 1w2
390
+ 1wr
391
+ 1wu
392
+ 1xa
393
+ 1xe
394
+ 1xi
395
+ 1xo
396
+ 1xu
397
+ 1ya
398
+ 1ye
399
+ yi2
400
+ 1yo
401
+ 1yu
402
+ 4za
403
+ 1z2b1
404
+ ze2
405
+ 1z2
406
+ zi2
407
+ zo2
408
+ zu2