hexapdf 0.45.0 → 0.46.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +87 -47
- data/examples/019-acro_form.rb +5 -0
- data/lib/hexapdf/cli/inspect.rb +5 -0
- data/lib/hexapdf/composer.rb +1 -1
- data/lib/hexapdf/configuration.rb +8 -0
- data/lib/hexapdf/digital_signature/cms_handler.rb +31 -3
- data/lib/hexapdf/digital_signature/signing/default_handler.rb +9 -1
- data/lib/hexapdf/digital_signature/signing/signed_data_creator.rb +5 -1
- data/lib/hexapdf/document/layout.rb +48 -27
- data/lib/hexapdf/document.rb +24 -2
- data/lib/hexapdf/importer.rb +15 -5
- data/lib/hexapdf/layout/box.rb +25 -28
- data/lib/hexapdf/layout/frame.rb +1 -1
- data/lib/hexapdf/layout/inline_box.rb +17 -23
- data/lib/hexapdf/layout/list_box.rb +24 -29
- data/lib/hexapdf/layout/page_style.rb +23 -16
- data/lib/hexapdf/layout/style.rb +2 -2
- data/lib/hexapdf/layout/text_box.rb +2 -6
- data/lib/hexapdf/parser.rb +5 -1
- data/lib/hexapdf/revisions.rb +1 -1
- data/lib/hexapdf/stream.rb +3 -3
- data/lib/hexapdf/tokenizer.rb +3 -2
- data/lib/hexapdf/type/acro_form/button_field.rb +2 -0
- data/lib/hexapdf/type/acro_form/choice_field.rb +2 -0
- data/lib/hexapdf/type/acro_form/field.rb +8 -0
- data/lib/hexapdf/type/acro_form/form.rb +2 -1
- data/lib/hexapdf/type/acro_form/text_field.rb +2 -0
- data/lib/hexapdf/version.rb +1 -1
- data/test/hexapdf/digital_signature/common.rb +66 -84
- data/test/hexapdf/digital_signature/signing/test_default_handler.rb +7 -0
- data/test/hexapdf/digital_signature/signing/test_signed_data_creator.rb +9 -0
- data/test/hexapdf/digital_signature/test_cms_handler.rb +41 -1
- data/test/hexapdf/digital_signature/test_handler.rb +2 -1
- data/test/hexapdf/document/test_layout.rb +28 -5
- data/test/hexapdf/layout/test_box.rb +12 -5
- data/test/hexapdf/layout/test_frame.rb +12 -2
- data/test/hexapdf/layout/test_inline_box.rb +17 -28
- data/test/hexapdf/layout/test_list_box.rb +5 -5
- data/test/hexapdf/layout/test_page_style.rb +7 -2
- data/test/hexapdf/layout/test_text_box.rb +3 -9
- data/test/hexapdf/layout/test_text_layouter.rb +0 -3
- data/test/hexapdf/test_document.rb +27 -0
- data/test/hexapdf/test_importer.rb +17 -0
- data/test/hexapdf/test_revisions.rb +54 -41
- data/test/hexapdf/type/acro_form/test_form.rb +9 -0
- metadata +2 -2
@@ -357,46 +357,59 @@ describe HexaPDF::Revisions do
|
|
357
357
|
end
|
358
358
|
end
|
359
359
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
360
|
+
describe "linearzied PDFs" do
|
361
|
+
before do
|
362
|
+
@io = StringIO.new(<<~EOF)
|
363
|
+
%PDF-1.2
|
364
|
+
5 0 obj
|
365
|
+
<</Linearized 1>>
|
366
|
+
endobj
|
367
|
+
xref
|
368
|
+
5 1
|
369
|
+
0000000009 00000 n
|
370
|
+
trailer
|
371
|
+
<</ID[(a)(b)]/Info 1 0 R/Root 2 0 R/Size 6/Prev 394>>
|
372
|
+
%
|
373
|
+
1 0 obj
|
374
|
+
<</ModDate(D:20221205233910+01'00')/Producer(HexaPDF version 0.27.0)>>
|
375
|
+
endobj
|
376
|
+
2 0 obj
|
377
|
+
<</Type/Catalog/Pages 3 0 R>>
|
378
|
+
endobj
|
379
|
+
3 0 obj
|
380
|
+
<</Type/Pages/Kids[4 0 R]/Count 1>>
|
381
|
+
endobj
|
382
|
+
4 0 obj
|
383
|
+
<</Type/Page/MediaBox[0 0 595 842]/Parent 3 0 R/Resources<<>>>>
|
384
|
+
endobj
|
385
|
+
xref
|
386
|
+
0 5
|
387
|
+
0000000000 65535 f
|
388
|
+
0000000133 00000 n
|
389
|
+
0000000219 00000 n
|
390
|
+
0000000264 00000 n
|
391
|
+
0000000315 00000 n
|
392
|
+
trailer
|
393
|
+
<</ID[(a)(b)]/Info 1 0 R/Root 2 0 R/Size 5>>
|
394
|
+
startxref
|
395
|
+
41
|
396
|
+
%%EOF
|
397
|
+
EOF
|
398
|
+
end
|
399
|
+
|
400
|
+
it "merges the two revisions of a linearized PDF into one" do
|
401
|
+
doc = HexaPDF::Document.new(io: @io, config: {'parser.try_xref_reconstruction' => false})
|
402
|
+
assert(doc.revisions.parser.linearized?)
|
403
|
+
assert_equal(1, doc.revisions.count)
|
404
|
+
assert_same(5, doc.revisions.current.xref_section.max_oid)
|
405
|
+
end
|
406
|
+
|
407
|
+
it "works for a fake linearized PDF where the first xref section isn't actually used" do
|
408
|
+
@io.string[-9..-1] = "394\n%%EOF\n"
|
409
|
+
doc = HexaPDF::Document.new(io: @io, config: {'parser.try_xref_reconstruction' => false})
|
410
|
+
assert(doc.revisions.parser.linearized?)
|
411
|
+
assert_equal(1, doc.revisions.count)
|
412
|
+
assert_same(4, doc.revisions.current.xref_section.max_oid)
|
413
|
+
end
|
401
414
|
end
|
402
415
|
end
|
@@ -274,6 +274,15 @@ describe HexaPDF::Type::AcroForm::Form do
|
|
274
274
|
assert(obj.null?)
|
275
275
|
end
|
276
276
|
|
277
|
+
it "deletes a field with an embedded widget annotation" do
|
278
|
+
widget = @field.create_widget(@doc.pages.add, Rect: [0, 0, 0, 0])
|
279
|
+
assert_equal(widget, @field)
|
280
|
+
refute(@doc.pages[0][:Annots].empty?)
|
281
|
+
@acro_form.delete_field(@field)
|
282
|
+
assert(@doc.pages[0][:Annots].empty?)
|
283
|
+
assert(@field.null?)
|
284
|
+
end
|
285
|
+
|
277
286
|
it "deletes all widget annotations from the document and the annotation array" do
|
278
287
|
widget1 = @field.create_widget(@doc.pages.add, Rect: [0, 0, 0, 0])
|
279
288
|
widget2 = @field.create_widget(@doc.pages.add, Rect: [0, 0, 0, 0])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexapdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|