hexapdf 0.11.7 → 0.12.2
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 +121 -0
- data/LICENSE +1 -1
- data/examples/001-hello_world.rb +1 -1
- data/examples/002-graphics.rb +1 -1
- data/examples/003-arcs.rb +1 -1
- data/examples/004-optimizing.rb +1 -1
- data/examples/005-merging.rb +1 -1
- data/examples/006-standard_pdf_fonts.rb +1 -1
- data/examples/007-truetype.rb +1 -1
- data/examples/008-show_char_bboxes.rb +1 -1
- data/examples/009-text_layouter_alignment.rb +1 -1
- data/examples/010-text_layouter_inline_boxes.rb +1 -1
- data/examples/011-text_layouter_line_wrapping.rb +1 -1
- data/examples/012-text_layouter_styling.rb +1 -1
- data/examples/013-text_layouter_shapes.rb +1 -1
- data/examples/014-text_in_polygon.rb +1 -1
- data/examples/015-boxes.rb +1 -1
- data/examples/016-frame_automatic_box_placement.rb +1 -1
- data/examples/017-frame_text_flow.rb +1 -1
- data/examples/018-composer.rb +1 -1
- data/examples/019-acro_form.rb +51 -0
- data/lib/hexapdf.rb +1 -1
- data/lib/hexapdf/cli.rb +3 -1
- data/lib/hexapdf/cli/batch.rb +1 -1
- data/lib/hexapdf/cli/command.rb +18 -9
- data/lib/hexapdf/cli/files.rb +1 -1
- data/lib/hexapdf/cli/form.rb +240 -0
- data/lib/hexapdf/cli/image2pdf.rb +1 -1
- data/lib/hexapdf/cli/images.rb +1 -1
- data/lib/hexapdf/cli/info.rb +1 -1
- data/lib/hexapdf/cli/inspect.rb +1 -1
- data/lib/hexapdf/cli/merge.rb +1 -1
- data/lib/hexapdf/cli/modify.rb +1 -1
- data/lib/hexapdf/cli/optimize.rb +1 -1
- data/lib/hexapdf/cli/split.rb +1 -1
- data/lib/hexapdf/cli/watermark.rb +1 -1
- data/lib/hexapdf/composer.rb +2 -2
- data/lib/hexapdf/configuration.rb +66 -11
- data/lib/hexapdf/content.rb +3 -1
- data/lib/hexapdf/content/canvas.rb +5 -18
- data/lib/hexapdf/content/color_space.rb +111 -32
- data/lib/hexapdf/content/graphic_object.rb +1 -1
- data/lib/hexapdf/content/graphic_object/arc.rb +1 -1
- data/lib/hexapdf/content/graphic_object/endpoint_arc.rb +1 -1
- data/lib/hexapdf/content/graphic_object/geom2d.rb +1 -1
- data/lib/hexapdf/content/graphic_object/solid_arc.rb +1 -1
- data/lib/hexapdf/content/graphics_state.rb +1 -1
- data/lib/hexapdf/content/operator.rb +9 -9
- data/lib/hexapdf/content/parser.rb +18 -5
- data/lib/hexapdf/content/processor.rb +1 -1
- data/lib/hexapdf/content/transformation_matrix.rb +1 -1
- data/lib/hexapdf/data_dir.rb +1 -1
- data/lib/hexapdf/dictionary.rb +1 -1
- data/lib/hexapdf/dictionary_fields.rb +1 -1
- data/lib/hexapdf/document.rb +14 -5
- data/lib/hexapdf/document/files.rb +1 -1
- data/lib/hexapdf/document/fonts.rb +1 -1
- data/lib/hexapdf/document/images.rb +1 -1
- data/lib/hexapdf/document/pages.rb +3 -14
- data/lib/hexapdf/encryption.rb +1 -1
- data/lib/hexapdf/encryption/aes.rb +1 -1
- data/lib/hexapdf/encryption/arc4.rb +1 -1
- data/lib/hexapdf/encryption/fast_aes.rb +1 -1
- data/lib/hexapdf/encryption/fast_arc4.rb +1 -1
- data/lib/hexapdf/encryption/identity.rb +1 -1
- data/lib/hexapdf/encryption/ruby_aes.rb +1 -1
- data/lib/hexapdf/encryption/ruby_arc4.rb +1 -1
- data/lib/hexapdf/encryption/security_handler.rb +7 -1
- data/lib/hexapdf/encryption/standard_security_handler.rb +1 -1
- data/lib/hexapdf/error.rb +1 -1
- data/lib/hexapdf/filter.rb +3 -3
- data/lib/hexapdf/filter/ascii85_decode.rb +1 -1
- data/lib/hexapdf/filter/ascii_hex_decode.rb +1 -1
- data/lib/hexapdf/filter/encryption.rb +1 -1
- data/lib/hexapdf/filter/flate_decode.rb +1 -1
- data/lib/hexapdf/filter/lzw_decode.rb +1 -1
- data/lib/hexapdf/filter/{jpx_decode.rb → pass_through.rb} +5 -5
- data/lib/hexapdf/filter/predictor.rb +1 -1
- data/lib/hexapdf/filter/run_length_decode.rb +1 -1
- data/lib/hexapdf/font/cmap.rb +1 -1
- data/lib/hexapdf/font/cmap/parser.rb +1 -1
- data/lib/hexapdf/font/cmap/writer.rb +1 -1
- data/lib/hexapdf/font/encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/base.rb +9 -1
- data/lib/hexapdf/font/encoding/difference_encoding.rb +7 -1
- data/lib/hexapdf/font/encoding/glyph_list.rb +1 -1
- data/lib/hexapdf/font/encoding/mac_expert_encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/mac_roman_encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/standard_encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/symbol_encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/win_ansi_encoding.rb +1 -1
- data/lib/hexapdf/font/encoding/zapf_dingbats_encoding.rb +1 -1
- data/lib/hexapdf/font/invalid_glyph.rb +1 -1
- data/lib/hexapdf/font/true_type.rb +1 -1
- data/lib/hexapdf/font/true_type/builder.rb +1 -1
- data/lib/hexapdf/font/true_type/font.rb +1 -1
- data/lib/hexapdf/font/true_type/optimizer.rb +1 -1
- data/lib/hexapdf/font/true_type/subsetter.rb +1 -1
- data/lib/hexapdf/font/true_type/table.rb +1 -1
- data/lib/hexapdf/font/true_type/table/cmap.rb +1 -1
- data/lib/hexapdf/font/true_type/table/cmap_subtable.rb +1 -1
- data/lib/hexapdf/font/true_type/table/directory.rb +1 -1
- data/lib/hexapdf/font/true_type/table/glyf.rb +1 -1
- data/lib/hexapdf/font/true_type/table/head.rb +1 -1
- data/lib/hexapdf/font/true_type/table/hhea.rb +1 -1
- data/lib/hexapdf/font/true_type/table/hmtx.rb +1 -1
- data/lib/hexapdf/font/true_type/table/kern.rb +1 -1
- data/lib/hexapdf/font/true_type/table/loca.rb +1 -1
- data/lib/hexapdf/font/true_type/table/maxp.rb +1 -1
- data/lib/hexapdf/font/true_type/table/name.rb +1 -1
- data/lib/hexapdf/font/true_type/table/os2.rb +1 -1
- data/lib/hexapdf/font/true_type/table/post.rb +1 -1
- data/lib/hexapdf/font/true_type_wrapper.rb +54 -51
- data/lib/hexapdf/font/type1.rb +1 -1
- data/lib/hexapdf/font/type1/afm_parser.rb +1 -1
- data/lib/hexapdf/font/type1/character_metrics.rb +1 -1
- data/lib/hexapdf/font/type1/font.rb +1 -1
- data/lib/hexapdf/font/type1/font_metrics.rb +1 -1
- data/lib/hexapdf/font/type1/pfb_parser.rb +1 -1
- data/lib/hexapdf/font/type1_wrapper.rb +68 -52
- data/lib/hexapdf/font_loader.rb +1 -1
- data/lib/hexapdf/font_loader/from_configuration.rb +1 -1
- data/lib/hexapdf/font_loader/from_file.rb +1 -1
- data/lib/hexapdf/font_loader/standard14.rb +1 -1
- data/lib/hexapdf/image_loader.rb +1 -1
- data/lib/hexapdf/image_loader/jpeg.rb +1 -1
- data/lib/hexapdf/image_loader/pdf.rb +1 -1
- data/lib/hexapdf/image_loader/png.rb +1 -1
- data/lib/hexapdf/importer.rb +2 -4
- data/lib/hexapdf/layout.rb +1 -1
- data/lib/hexapdf/layout/box.rb +1 -1
- data/lib/hexapdf/layout/frame.rb +1 -1
- data/lib/hexapdf/layout/image_box.rb +1 -1
- data/lib/hexapdf/layout/inline_box.rb +1 -1
- data/lib/hexapdf/layout/line.rb +1 -1
- data/lib/hexapdf/layout/numeric_refinements.rb +1 -1
- data/lib/hexapdf/layout/style.rb +1 -1
- data/lib/hexapdf/layout/text_box.rb +1 -1
- data/lib/hexapdf/layout/text_fragment.rb +1 -1
- data/lib/hexapdf/layout/text_layouter.rb +1 -1
- data/lib/hexapdf/layout/text_shaper.rb +1 -1
- data/lib/hexapdf/layout/width_from_polygon.rb +1 -1
- data/lib/hexapdf/name_tree_node.rb +1 -1
- data/lib/hexapdf/number_tree_node.rb +1 -1
- data/lib/hexapdf/object.rb +2 -2
- data/lib/hexapdf/parser.rb +4 -3
- data/lib/hexapdf/pdf_array.rb +1 -1
- data/lib/hexapdf/rectangle.rb +31 -1
- data/lib/hexapdf/reference.rb +1 -1
- data/lib/hexapdf/revision.rb +2 -1
- data/lib/hexapdf/revisions.rb +1 -1
- data/lib/hexapdf/serializer.rb +2 -2
- data/lib/hexapdf/stream.rb +1 -1
- data/lib/hexapdf/task.rb +1 -1
- data/lib/hexapdf/task/dereference.rb +1 -1
- data/lib/hexapdf/task/optimize.rb +1 -1
- data/lib/hexapdf/tokenizer.rb +1 -1
- data/lib/hexapdf/type.rb +1 -1
- data/lib/hexapdf/type/acro_form.rb +7 -1
- data/lib/hexapdf/type/acro_form/appearance_generator.rb +401 -0
- data/lib/hexapdf/type/acro_form/button_field.rb +300 -0
- data/lib/hexapdf/type/acro_form/choice_field.rb +220 -0
- data/lib/hexapdf/type/acro_form/field.rb +220 -17
- data/lib/hexapdf/type/acro_form/form.rb +157 -7
- data/lib/hexapdf/type/acro_form/text_field.rb +186 -0
- data/lib/hexapdf/type/acro_form/variable_text_field.rb +122 -0
- data/lib/hexapdf/type/action.rb +1 -1
- data/lib/hexapdf/type/actions.rb +1 -1
- data/lib/hexapdf/type/actions/go_to.rb +1 -1
- data/lib/hexapdf/type/actions/go_to_r.rb +1 -1
- data/lib/hexapdf/type/actions/launch.rb +1 -1
- data/lib/hexapdf/type/actions/uri.rb +1 -1
- data/lib/hexapdf/type/annotation.rb +73 -3
- data/lib/hexapdf/type/annotations.rb +1 -1
- data/lib/hexapdf/type/annotations/link.rb +2 -2
- data/lib/hexapdf/type/annotations/markup_annotation.rb +1 -1
- data/lib/hexapdf/type/annotations/text.rb +1 -1
- data/lib/hexapdf/type/annotations/widget.rb +239 -2
- data/lib/hexapdf/type/catalog.rb +21 -1
- data/lib/hexapdf/type/cid_font.rb +1 -1
- data/lib/hexapdf/type/embedded_file.rb +1 -1
- data/lib/hexapdf/type/file_specification.rb +1 -1
- data/lib/hexapdf/type/font.rb +18 -1
- data/lib/hexapdf/type/font_descriptor.rb +2 -2
- data/lib/hexapdf/type/font_simple.rb +1 -1
- data/lib/hexapdf/type/font_true_type.rb +1 -1
- data/lib/hexapdf/type/font_type0.rb +1 -1
- data/lib/hexapdf/type/font_type1.rb +16 -1
- data/lib/hexapdf/type/font_type3.rb +1 -1
- data/lib/hexapdf/type/form.rb +10 -1
- data/lib/hexapdf/type/graphics_state_parameter.rb +1 -1
- data/lib/hexapdf/type/icon_fit.rb +1 -1
- data/lib/hexapdf/type/image.rb +3 -1
- data/lib/hexapdf/type/info.rb +1 -1
- data/lib/hexapdf/type/names.rb +1 -1
- data/lib/hexapdf/type/object_stream.rb +1 -1
- data/lib/hexapdf/type/page.rb +20 -5
- data/lib/hexapdf/type/page_tree_node.rb +8 -11
- data/lib/hexapdf/type/resources.rb +16 -3
- data/lib/hexapdf/type/trailer.rb +2 -3
- data/lib/hexapdf/type/viewer_preferences.rb +1 -1
- data/lib/hexapdf/type/xref_stream.rb +1 -1
- data/lib/hexapdf/utils/bit_field.rb +38 -24
- data/lib/hexapdf/utils/bit_stream.rb +1 -1
- data/lib/hexapdf/utils/graphics_helpers.rb +1 -1
- data/lib/hexapdf/utils/lru_cache.rb +1 -1
- data/lib/hexapdf/utils/math_helpers.rb +1 -1
- data/lib/hexapdf/utils/object_hash.rb +1 -1
- data/lib/hexapdf/utils/pdf_doc_encoding.rb +1 -1
- data/lib/hexapdf/utils/sorted_tree_node.rb +1 -1
- data/lib/hexapdf/version.rb +2 -2
- data/lib/hexapdf/writer.rb +1 -1
- data/lib/hexapdf/xref_section.rb +1 -1
- data/test/hexapdf/content/common.rb +2 -2
- data/test/hexapdf/content/test_color_space.rb +71 -8
- data/test/hexapdf/content/test_operator.rb +22 -22
- data/test/hexapdf/content/test_parser.rb +14 -0
- data/test/hexapdf/document/test_fonts.rb +1 -1
- data/test/hexapdf/document/test_pages.rb +6 -6
- data/test/hexapdf/encryption/test_security_handler.rb +4 -0
- data/test/hexapdf/font/encoding/test_base.rb +10 -0
- data/test/hexapdf/font/encoding/test_difference_encoding.rb +8 -0
- data/test/hexapdf/font/test_true_type_wrapper.rb +10 -7
- data/test/hexapdf/font/test_type1_wrapper.rb +33 -8
- data/test/hexapdf/layout/test_style.rb +1 -1
- data/test/hexapdf/test_document.rb +12 -0
- data/test/hexapdf/test_parser.rb +10 -0
- data/test/hexapdf/test_rectangle.rb +14 -0
- data/test/hexapdf/test_revision.rb +3 -0
- data/test/hexapdf/test_serializer.rb +3 -3
- data/test/hexapdf/test_writer.rb +2 -2
- data/test/hexapdf/type/acro_form/test_appearance_generator.rb +515 -0
- data/test/hexapdf/type/acro_form/test_button_field.rb +276 -0
- data/test/hexapdf/type/acro_form/test_choice_field.rb +137 -0
- data/test/hexapdf/type/acro_form/test_field.rb +124 -6
- data/test/hexapdf/type/acro_form/test_form.rb +189 -22
- data/test/hexapdf/type/acro_form/test_text_field.rb +119 -0
- data/test/hexapdf/type/acro_form/test_variable_text_field.rb +77 -0
- data/test/hexapdf/type/annotations/test_text.rb +1 -1
- data/test/hexapdf/type/annotations/test_widget.rb +199 -0
- data/test/hexapdf/type/test_annotation.rb +45 -0
- data/test/hexapdf/type/test_catalog.rb +18 -0
- data/test/hexapdf/type/test_font.rb +5 -0
- data/test/hexapdf/type/test_font_type1.rb +8 -0
- data/test/hexapdf/type/test_form.rb +18 -0
- data/test/hexapdf/type/test_image.rb +7 -0
- data/test/hexapdf/type/test_page.rb +37 -6
- data/test/hexapdf/type/test_page_tree_node.rb +20 -12
- data/test/hexapdf/type/test_resources.rb +20 -0
- data/test/hexapdf/type/test_trailer.rb +4 -0
- data/test/hexapdf/utils/test_bit_field.rb +13 -1
- data/test/test_helper.rb +1 -1
- metadata +38 -18
- data/lib/hexapdf/filter/dct_decode.rb +0 -60
|
@@ -155,36 +155,44 @@ describe HexaPDF::Type::PageTreeNode do
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
it "deletes the correct page by index" do
|
|
158
|
-
|
|
158
|
+
@root.delete_page(2)
|
|
159
159
|
assert_equal(2, @kid12.page_count)
|
|
160
160
|
assert_equal(4, @kid1.page_count)
|
|
161
161
|
assert_equal(7, @root.page_count)
|
|
162
|
-
|
|
162
|
+
assert(@pages[2].null?)
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
@root.delete_page(4)
|
|
165
165
|
assert_equal(6, @root.page_count)
|
|
166
|
-
|
|
166
|
+
assert(@pages[5].null?)
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
it "deletes the given page" do
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
@root.delete_page(@pages[2])
|
|
171
|
+
assert(@pages[2].null?)
|
|
172
|
+
@root.delete_page(@pages[5])
|
|
173
|
+
assert(@pages[5].null?)
|
|
172
174
|
end
|
|
173
175
|
|
|
174
176
|
it "allows deleting a page from an intermediary node" do
|
|
175
|
-
|
|
177
|
+
@kid1.delete_page(@pages[2])
|
|
176
178
|
assert_equal(7, @root.page_count)
|
|
177
179
|
end
|
|
178
180
|
|
|
179
181
|
it "does nothing if the page index is not valid" do
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
@root.delete_page(20)
|
|
183
|
+
@root.delete_page(-20)
|
|
182
184
|
assert_equal(8, @root.page_count)
|
|
183
185
|
end
|
|
184
186
|
|
|
185
|
-
it "does nothing if the page
|
|
187
|
+
it "does nothing if the page has already been deleted" do
|
|
188
|
+
@root.delete_page(@pages[2])
|
|
189
|
+
@root.delete_page(@pages[2])
|
|
190
|
+
assert_equal(7, @root.page_count)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
it "fails if the page is not in its parent's /Kids array" do
|
|
186
194
|
@kid12[:Kids].delete_at(0)
|
|
187
|
-
|
|
195
|
+
assert_raises(HexaPDF::Error) { @root.delete_page(@pages[2]) }
|
|
188
196
|
assert_equal(8, @root.page_count)
|
|
189
197
|
end
|
|
190
198
|
|
|
@@ -193,7 +201,7 @@ describe HexaPDF::Type::PageTreeNode do
|
|
|
193
201
|
page = @doc.add({Type: :Page, Parent: pages})
|
|
194
202
|
pages[:Kids] << page
|
|
195
203
|
|
|
196
|
-
|
|
204
|
+
@root.delete_page(page)
|
|
197
205
|
assert_equal(8, @root.page_count)
|
|
198
206
|
end
|
|
199
207
|
end
|
|
@@ -25,6 +25,10 @@ describe HexaPDF::Type::Resources do
|
|
|
25
25
|
assert_kind_of(HexaPDF::Content::ColorSpace::Universal, @res.color_space(:CSName))
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
it "works for the Pattern color space" do
|
|
29
|
+
assert_kind_of(HexaPDF::Content::ColorSpace::Universal, @res.color_space(:Pattern))
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
it "returns the universal color space for unknown color spaces, with resolved references" do
|
|
29
33
|
data = @doc.add({Some: :data})
|
|
30
34
|
@res[:ColorSpace] = {CSName: [:SomeUnknownColorSpace,
|
|
@@ -168,6 +172,22 @@ describe HexaPDF::Type::Resources do
|
|
|
168
172
|
end
|
|
169
173
|
end
|
|
170
174
|
|
|
175
|
+
describe "pattern" do
|
|
176
|
+
it "invokes the object_getter method" do
|
|
177
|
+
assert_method_invoked(@res, :object_getter, [:Pattern, :test]) do
|
|
178
|
+
@res.pattern(:test)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
describe "add_pattern" do
|
|
184
|
+
it "invokes the object_setter method" do
|
|
185
|
+
assert_method_invoked(@res, :object_setter, [:Pattern, 'P', :test]) do
|
|
186
|
+
@res.add_pattern(:test)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
171
191
|
describe "validation" do
|
|
172
192
|
it "assigns the default value if ProcSet is not set" do
|
|
173
193
|
@res.validate
|
|
@@ -9,12 +9,16 @@ describe HexaPDF::Type::Trailer do
|
|
|
9
9
|
before do
|
|
10
10
|
@doc = Object.new
|
|
11
11
|
@doc.instance_variable_set(:@version, '1.2')
|
|
12
|
+
|
|
12
13
|
def (@doc).version=(v); @version = v; end
|
|
14
|
+
|
|
13
15
|
def (@doc).deref(obj); obj; end
|
|
16
|
+
|
|
14
17
|
def (@doc).wrap(obj, *)
|
|
15
18
|
(obj.kind_of?(Array) ? HexaPDF::PDFArray : HexaPDF::Dictionary).
|
|
16
19
|
new(obj, oid: (obj.oid rescue 0))
|
|
17
20
|
end
|
|
21
|
+
|
|
18
22
|
root = HexaPDF::Dictionary.new({}, oid: 3)
|
|
19
23
|
@obj = HexaPDF::Type::Trailer.new({Size: 10, Root: root}, document: @doc)
|
|
20
24
|
end
|
|
@@ -7,7 +7,8 @@ class TestBitField
|
|
|
7
7
|
|
|
8
8
|
extend HexaPDF::Utils::BitField
|
|
9
9
|
attr_accessor :data
|
|
10
|
-
bit_field(:data, {bit0: 0, bit1: 1, bit5: 5}, lister: "list", getter: "get", setter: "set"
|
|
10
|
+
bit_field(:data, {bit0: 0, bit1: 1, bit5: 5}, lister: "list", getter: "get", setter: "set",
|
|
11
|
+
unsetter: 'unset')
|
|
11
12
|
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -16,6 +17,10 @@ describe HexaPDF::Utils::BitField do
|
|
|
16
17
|
@obj = TestBitField.new
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
it "allows inspection of the defined bits" do
|
|
21
|
+
assert_equal({bit0: 0, bit1: 1, bit5: 5}, TestBitField::DATA_BIT_MAPPING)
|
|
22
|
+
end
|
|
23
|
+
|
|
19
24
|
it "returns all bit names using the lister method" do
|
|
20
25
|
@obj.data = 0b100011
|
|
21
26
|
assert_equal([:bit0, :bit1, :bit5], @obj.list)
|
|
@@ -40,6 +45,13 @@ describe HexaPDF::Utils::BitField do
|
|
|
40
45
|
assert_equal(0b100001, @obj.data)
|
|
41
46
|
end
|
|
42
47
|
|
|
48
|
+
it "can unset a given bit via the unsetter method" do
|
|
49
|
+
@obj.set(:bit0, :bit5)
|
|
50
|
+
assert_equal(0b100001, @obj.data)
|
|
51
|
+
@obj.unset(:bit5)
|
|
52
|
+
assert_equal(0b000001, @obj.data)
|
|
53
|
+
end
|
|
54
|
+
|
|
43
55
|
it "fails if an unknown bit name or bit index is used with one of the methods" do
|
|
44
56
|
e = assert_raises(ArgumentError) { @obj.get(10) }
|
|
45
57
|
assert_equal("Invalid bit field name or index '10' for TestBitField#data", e.message)
|
data/test/test_helper.rb
CHANGED
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.12.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Leitner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cmdparse
|
|
@@ -36,54 +36,62 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.
|
|
39
|
+
version: '0.3'
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.
|
|
46
|
+
version: '0.3'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: kramdown
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
54
|
-
- - ">="
|
|
55
|
-
- !ruby/object:Gem::Version
|
|
56
|
-
version: 1.13.0
|
|
53
|
+
version: '2.3'
|
|
57
54
|
type: :development
|
|
58
55
|
prerelease: false
|
|
59
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
60
57
|
requirements:
|
|
61
58
|
- - "~>"
|
|
62
59
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '
|
|
64
|
-
|
|
60
|
+
version: '2.3'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: reline
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.1'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
65
73
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: 1
|
|
74
|
+
version: '0.1'
|
|
67
75
|
- !ruby/object:Gem::Dependency
|
|
68
76
|
name: rubocop
|
|
69
77
|
requirement: !ruby/object:Gem::Requirement
|
|
70
78
|
requirements:
|
|
71
79
|
- - "~>"
|
|
72
80
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '0.
|
|
81
|
+
version: '0.82'
|
|
74
82
|
- - ">="
|
|
75
83
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: 0.
|
|
84
|
+
version: 0.82.0
|
|
77
85
|
type: :development
|
|
78
86
|
prerelease: false
|
|
79
87
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
88
|
requirements:
|
|
81
89
|
- - "~>"
|
|
82
90
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '0.
|
|
91
|
+
version: '0.82'
|
|
84
92
|
- - ">="
|
|
85
93
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: 0.
|
|
94
|
+
version: 0.82.0
|
|
87
95
|
description: |
|
|
88
96
|
HexaPDF is a pure Ruby library with an accompanying application for working with PDF
|
|
89
97
|
files.
|
|
@@ -209,6 +217,7 @@ files:
|
|
|
209
217
|
- examples/016-frame_automatic_box_placement.rb
|
|
210
218
|
- examples/017-frame_text_flow.rb
|
|
211
219
|
- examples/018-composer.rb
|
|
220
|
+
- examples/019-acro_form.rb
|
|
212
221
|
- examples/emoji-smile.png
|
|
213
222
|
- examples/emoji-wink.png
|
|
214
223
|
- examples/machupicchu.jpg
|
|
@@ -217,6 +226,7 @@ files:
|
|
|
217
226
|
- lib/hexapdf/cli/batch.rb
|
|
218
227
|
- lib/hexapdf/cli/command.rb
|
|
219
228
|
- lib/hexapdf/cli/files.rb
|
|
229
|
+
- lib/hexapdf/cli/form.rb
|
|
220
230
|
- lib/hexapdf/cli/image2pdf.rb
|
|
221
231
|
- lib/hexapdf/cli/images.rb
|
|
222
232
|
- lib/hexapdf/cli/info.rb
|
|
@@ -263,11 +273,10 @@ files:
|
|
|
263
273
|
- lib/hexapdf/filter.rb
|
|
264
274
|
- lib/hexapdf/filter/ascii85_decode.rb
|
|
265
275
|
- lib/hexapdf/filter/ascii_hex_decode.rb
|
|
266
|
-
- lib/hexapdf/filter/dct_decode.rb
|
|
267
276
|
- lib/hexapdf/filter/encryption.rb
|
|
268
277
|
- lib/hexapdf/filter/flate_decode.rb
|
|
269
|
-
- lib/hexapdf/filter/jpx_decode.rb
|
|
270
278
|
- lib/hexapdf/filter/lzw_decode.rb
|
|
279
|
+
- lib/hexapdf/filter/pass_through.rb
|
|
271
280
|
- lib/hexapdf/filter/predictor.rb
|
|
272
281
|
- lib/hexapdf/filter/run_length_decode.rb
|
|
273
282
|
- lib/hexapdf/font/cmap.rb
|
|
@@ -350,8 +359,13 @@ files:
|
|
|
350
359
|
- lib/hexapdf/tokenizer.rb
|
|
351
360
|
- lib/hexapdf/type.rb
|
|
352
361
|
- lib/hexapdf/type/acro_form.rb
|
|
362
|
+
- lib/hexapdf/type/acro_form/appearance_generator.rb
|
|
363
|
+
- lib/hexapdf/type/acro_form/button_field.rb
|
|
364
|
+
- lib/hexapdf/type/acro_form/choice_field.rb
|
|
353
365
|
- lib/hexapdf/type/acro_form/field.rb
|
|
354
366
|
- lib/hexapdf/type/acro_form/form.rb
|
|
367
|
+
- lib/hexapdf/type/acro_form/text_field.rb
|
|
368
|
+
- lib/hexapdf/type/acro_form/variable_text_field.rb
|
|
355
369
|
- lib/hexapdf/type/action.rb
|
|
356
370
|
- lib/hexapdf/type/actions.rb
|
|
357
371
|
- lib/hexapdf/type/actions/go_to.rb
|
|
@@ -580,8 +594,13 @@ files:
|
|
|
580
594
|
- test/hexapdf/test_type.rb
|
|
581
595
|
- test/hexapdf/test_writer.rb
|
|
582
596
|
- test/hexapdf/test_xref_section.rb
|
|
597
|
+
- test/hexapdf/type/acro_form/test_appearance_generator.rb
|
|
598
|
+
- test/hexapdf/type/acro_form/test_button_field.rb
|
|
599
|
+
- test/hexapdf/type/acro_form/test_choice_field.rb
|
|
583
600
|
- test/hexapdf/type/acro_form/test_field.rb
|
|
584
601
|
- test/hexapdf/type/acro_form/test_form.rb
|
|
602
|
+
- test/hexapdf/type/acro_form/test_text_field.rb
|
|
603
|
+
- test/hexapdf/type/acro_form/test_variable_text_field.rb
|
|
585
604
|
- test/hexapdf/type/actions/test_launch.rb
|
|
586
605
|
- test/hexapdf/type/actions/test_uri.rb
|
|
587
606
|
- test/hexapdf/type/annotations/test_markup_annotation.rb
|
|
@@ -634,7 +653,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
634
653
|
- !ruby/object:Gem::Version
|
|
635
654
|
version: '0'
|
|
636
655
|
requirements: []
|
|
637
|
-
|
|
656
|
+
rubyforge_project:
|
|
657
|
+
rubygems_version: 2.7.6.2
|
|
638
658
|
signing_key:
|
|
639
659
|
specification_version: 4
|
|
640
660
|
summary: HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8; frozen_string_literal: true -*-
|
|
2
|
-
#
|
|
3
|
-
#--
|
|
4
|
-
# This file is part of HexaPDF.
|
|
5
|
-
#
|
|
6
|
-
# HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
|
|
7
|
-
# Copyright (C) 2014-2019 Thomas Leitner
|
|
8
|
-
#
|
|
9
|
-
# HexaPDF is free software: you can redistribute it and/or modify it
|
|
10
|
-
# under the terms of the GNU Affero General Public License version 3 as
|
|
11
|
-
# published by the Free Software Foundation with the addition of the
|
|
12
|
-
# following permission added to Section 15 as permitted in Section 7(a):
|
|
13
|
-
# FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
|
|
14
|
-
# THOMAS LEITNER, THOMAS LEITNER DISCLAIMS THE WARRANTY OF NON
|
|
15
|
-
# INFRINGEMENT OF THIRD PARTY RIGHTS.
|
|
16
|
-
#
|
|
17
|
-
# HexaPDF is distributed in the hope that it will be useful, but WITHOUT
|
|
18
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
20
|
-
# License for more details.
|
|
21
|
-
#
|
|
22
|
-
# You should have received a copy of the GNU Affero General Public License
|
|
23
|
-
# along with HexaPDF. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
-
#
|
|
25
|
-
# The interactive user interfaces in modified source and object code
|
|
26
|
-
# versions of HexaPDF must display Appropriate Legal Notices, as required
|
|
27
|
-
# under Section 5 of the GNU Affero General Public License version 3.
|
|
28
|
-
#
|
|
29
|
-
# In accordance with Section 7(b) of the GNU Affero General Public
|
|
30
|
-
# License, a covered work must retain the producer line in every PDF that
|
|
31
|
-
# is created or manipulated using HexaPDF.
|
|
32
|
-
#
|
|
33
|
-
# If the GNU Affero General Public License doesn't fit your need,
|
|
34
|
-
# commercial licenses are available at <https://gettalong.at/hexapdf/>.
|
|
35
|
-
#++
|
|
36
|
-
|
|
37
|
-
module HexaPDF
|
|
38
|
-
module Filter
|
|
39
|
-
|
|
40
|
-
# The DCTDecode filter is currently only implemented as a pass-through filter, ie. the source
|
|
41
|
-
# gets passed on unmodified. This also means that the :ColorTransform parameter is not
|
|
42
|
-
# evaluated!
|
|
43
|
-
#
|
|
44
|
-
# See: HexaPDF::Filter, PDF1.7 s7.4.8
|
|
45
|
-
module DCTDecode
|
|
46
|
-
|
|
47
|
-
# See HexaPDF::Filter
|
|
48
|
-
def self.decoder(source, _ = nil)
|
|
49
|
-
source
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# See HexaPDF::Filter
|
|
53
|
-
def self.encoder(source, _ = nil)
|
|
54
|
-
source
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
60
|
-
end
|