hexapdf 0.39.0 → 0.39.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/hexapdf/layout/table_box.rb +3 -2
- data/lib/hexapdf/type/acro_form/field.rb +1 -1
- data/lib/hexapdf/version.rb +1 -1
- data/test/hexapdf/layout/test_table_box.rb +26 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07f7fd9468ec9c36993f4b1f2189704d65c1c73f7fa1ea30d44f6cb0a67fa92c
|
4
|
+
data.tar.gz: 1cad88a48910fd65a9dae7a90dcfe6ac34ef5ba9f69172a18bd52052fb10b99c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeee46c22616abbca812ef441100e33534384db831aadf04df9b9382920aa58105be04046a76a9da76951c1d0bc39126e4ef33c43fa3401077c34604ff414acc
|
7
|
+
data.tar.gz: 1cd42546ff96980f6fbfeaae450a7f8657350ce3b23692b508b87718028e68fe50acd9ca8b744bc755f9b79029ecd41f5cb1cedc046209336594c3fba5a1807b
|
data/CHANGELOG.md
CHANGED
@@ -417,7 +417,8 @@ module HexaPDF
|
|
417
417
|
break
|
418
418
|
end
|
419
419
|
end
|
420
|
-
|
420
|
+
|
421
|
+
[height - available_height, last_fitted_row_index < start_row ? -1 : last_fitted_row_index]
|
421
422
|
end
|
422
423
|
|
423
424
|
# Draws the rows from +start_row+ to +end_row+ on the given +canvas+, with the top-left
|
@@ -647,7 +648,7 @@ module HexaPDF
|
|
647
648
|
end
|
648
649
|
end
|
649
650
|
|
650
|
-
# Splits the content of the
|
651
|
+
# Splits the content of the table box. This method is called from Box#split.
|
651
652
|
def split_content(_available_width, _available_height, _frame)
|
652
653
|
if @special_cells_fit_not_successful || @last_fitted_row_index < 0
|
653
654
|
[nil, self]
|
@@ -284,7 +284,7 @@ module HexaPDF
|
|
284
284
|
end
|
285
285
|
|
286
286
|
# Creates a new widget annotation for this form field (must be a terminal field!) on the
|
287
|
-
# given +page+, adding the +values+ to the created widget annotation
|
287
|
+
# given +page+, adding the +values+ to the created widget annotation object.
|
288
288
|
#
|
289
289
|
# If +allow_embedded+ is +false+, embedding the first widget in the field itself is not
|
290
290
|
# allowed.
|
data/lib/hexapdf/version.rb
CHANGED
@@ -362,8 +362,8 @@ describe HexaPDF::Layout::TableBox do
|
|
362
362
|
@doc = HexaPDF::Document.new
|
363
363
|
@page = @doc.pages.add
|
364
364
|
@frame = HexaPDF::Layout::Frame.new(0, 0, 160, 100, context: @page)
|
365
|
-
draw_block = lambda {|canvas, _box| canvas.move_to(0, 0).end_path }
|
366
|
-
@fixed_size_boxes = 15.times.map { HexaPDF::Layout::Box.new(width: 20, height: 10,
|
365
|
+
@draw_block = lambda {|canvas, _box| canvas.move_to(0, 0).end_path }
|
366
|
+
@fixed_size_boxes = 15.times.map { HexaPDF::Layout::Box.new(width: 20, height: 10, &@draw_block) }
|
367
367
|
end
|
368
368
|
|
369
369
|
def create_box(**kwargs)
|
@@ -561,6 +561,30 @@ describe HexaPDF::Layout::TableBox do
|
|
561
561
|
assert_equal(-1, box_b.last_fitted_row_index)
|
562
562
|
end
|
563
563
|
|
564
|
+
it "splits the table correctly when row spans and a too-high cell are involved" do
|
565
|
+
cells = [[@fixed_size_boxes[0], @fixed_size_boxes[1]],
|
566
|
+
[{row_span: 2, content: @fixed_size_boxes[2]}, @fixed_size_boxes[3]],
|
567
|
+
[HexaPDF::Layout::Box.new(width: 20, height: 150, &@draw_block)]]
|
568
|
+
box = create_box(cells: cells)
|
569
|
+
|
570
|
+
refute(box.fit(100, 100, @frame))
|
571
|
+
box_a, box_b = box.split(100, 100, @frame)
|
572
|
+
assert_same(box_a, box)
|
573
|
+
assert(box_b.split_box?)
|
574
|
+
assert_equal(0, box_a.start_row_index)
|
575
|
+
assert_equal(0, box_a.last_fitted_row_index)
|
576
|
+
assert_equal(1, box_b.start_row_index)
|
577
|
+
assert_equal(-1, box_b.last_fitted_row_index)
|
578
|
+
|
579
|
+
refute(box_b.fit(100, 100, @frame))
|
580
|
+
box_c, box_d = box_b.split(100, 100, @frame)
|
581
|
+
assert_nil(box_c)
|
582
|
+
assert_same(box_d, box_b)
|
583
|
+
assert(box_d.split_box?)
|
584
|
+
assert_equal(1, box_d.start_row_index)
|
585
|
+
assert_equal(-1, box_d.last_fitted_row_index)
|
586
|
+
end
|
587
|
+
|
564
588
|
it "splits the table if the header or footer rows don't fit" do
|
565
589
|
cells_creator = lambda {|_| [@fixed_size_boxes[10, 2]] }
|
566
590
|
[{header: cells_creator}, {footer: cells_creator}].each do |args|
|
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.39.
|
4
|
+
version: 0.39.1
|
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-03-
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|