fillable-pdf 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2e531a833cf7701b907be49fc29b6885241bc2d5
4
- data.tar.gz: e59582332f1377cd3bbef6d5fe53adf02f8e764b
2
+ SHA256:
3
+ metadata.gz: 6f75be2cd9e29a9a3d77a62387db476166b59e2fd6b74da3c15f54a46fecb152
4
+ data.tar.gz: b1aa52a24db820d00fbf5a8bcf2419f63c5a9e4f7c08429cff2d8e05cae9639f
5
5
  SHA512:
6
- metadata.gz: c021fe8a59d2397e3e54174d1cd109e40b3aa0fe740296f39582aeaa486ef0e302139aed079ec729a0cfde465d81c90c09bd756278bcf5591cced8bc15636dc5
7
- data.tar.gz: aadd836fbfa70a083dd76b71ea1766b53fb0f2eafb8bba1a5ede6267a7e13abaafbd5dc9be767de6ce962b1c1f9ad1ef3d726c23f74c0c3ced4e815efffc179a
6
+ metadata.gz: 2634346658842e6c27d5be651085443771b5c70c32616dd85fd5aae8d2e0a5f2adee348405cfab7fdd74384f00a8a65726b6b04c2051320f9d74a75f86f9255c
7
+ data.tar.gz: 6028a2dd57e7e22a6f7fa1215b5efe72949480d55c9e13db882d6d7932931269ad251cfe3b84f197359039255bee556d2e2fe0aac26d2cbd665ff32302944f6f
data/.gitignore CHANGED
@@ -10,4 +10,5 @@
10
10
  /Gemfile.lock
11
11
  /pkg/
12
12
  /spec/reports/
13
- /tmp/
13
+ /tmp/
14
+ tmp.pdf
@@ -0,0 +1,35 @@
1
+ require:
2
+ - rubocop-performance
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - .git/**/*
7
+
8
+ Layout/EmptyLineAfterGuardClause:
9
+ Enabled: false
10
+
11
+ Layout/SpaceInsideHashLiteralBraces:
12
+ Enabled: false
13
+
14
+ Metrics/LineLength:
15
+ Exclude:
16
+ - fillable-pdf.gemspec
17
+ Max: 120
18
+
19
+ Naming/AccessorMethodName:
20
+ Enabled: false
21
+
22
+ Naming/FileName:
23
+ Enabled: false
24
+
25
+ Style/Documentation:
26
+ Enabled: false
27
+
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: false
30
+
31
+ Style/GuardClause:
32
+ Enabled: false
33
+
34
+ Style/MutableConstant:
35
+ Enabled: false
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.4
7
+ before_install: gem install bundler -v 2.0.2
data/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # FillablePDF
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/fillable-pdf.svg)](https://rubygems.org/gems/fillable-pdf)
4
+ [![Build Status](https://api.travis-ci.org/plataformatec/fillable-pdf.svg?branch=master)](http://travis-ci.org/plataformatec/fillable-pdf)
4
5
 
5
6
  FillablePDF is an extremely simple and lightweight utility that bridges iText and Ruby in order to fill out fillable PDF forms or extract field values from previously filled out PDF forms.
6
7
 
8
+ ## Known Bugs (Rails + Passenger Phusion only)
9
+
10
+ if you are using Rails and hosting the app with Passenger Phusion (be it standalone or as a plugin for Apache or Nginx), the Java code within this gem simply hangs without any errors and warnings. If you need to deploy your Rails application, do not use Passenger Phusion. I have tested Puma, and it works fine. Not sure about other webservers.
7
11
 
8
12
  ## Installation
9
13
 
10
14
  **Ensure that your `JAVA_HOME` variable is set before installing this gem (see examples below).**
11
15
 
12
- * OSX: `/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home`
16
+ * OSX: `/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home`
13
17
  * Ubuntu/CentOS: `/usr/lib/jvm/java-1.8.0-openjdk`
14
18
 
15
19
  Add this line to your application's Gemfile:
@@ -41,7 +45,7 @@ pdf = FillablePDF.new 'input.pdf'
41
45
  An instance of `FillablePDF` has the following methods at its disposal:
42
46
 
43
47
  ```ruby
44
- # return true if the form has any fillable fields
48
+ fillable-pdf
45
49
  # output example: true
46
50
  pdf.any_fields?
47
51
  ```
@@ -55,22 +59,18 @@ pdf.num_fields
55
59
  ```ruby
56
60
  # retrieve a single field value by field name
57
61
  # output example: 'Richard'
58
- pdf.get_field(:full_name)
62
+ pdf.field(:full_name)
59
63
  ```
60
64
 
61
65
  ```ruby
62
- # retrieve a numeric field type by field value
66
+ # retrieve a field type by field name
63
67
  # numeric types should
64
68
  # output example: 4
65
- pdf.get_field_type(:football)
69
+ pdf.field_type(:football)
66
70
 
67
71
  # list of all field types
68
- Field::CHECKBOX
69
- Field::COMBO
70
- Field::LIST
71
- Field::NONE
72
- Field::PUSHBUTTON
73
- Field::RADIOBUTTON
72
+ Field::BUTTON
73
+ Field::CHOICE
74
74
  Field::SIGNATURE
75
75
  Field::TEXT
76
76
  ```
@@ -78,7 +78,7 @@ Field::TEXT
78
78
  ```ruby
79
79
  # retrieve a hash of field name and values
80
80
  # output example: {:last_name=>"Rahl", :first_name=>"Richard"}
81
- pdf.get_fields
81
+ pdf.fields
82
82
  ```
83
83
 
84
84
  ```ruby
@@ -95,8 +95,8 @@ pdf.set_fields(first_name: 'Richard', last_name: 'Rahl')
95
95
 
96
96
  ```ruby
97
97
  # rename field (i.e. change the name of the field)
98
- # this action also moves the field to the end of the hash
99
98
  # result: renames field name 'last_name' to 'surname'
99
+ # NOTE: this action does not take effect until the document is saved
100
100
  pdf.rename_field(:last_name, :surname)
101
101
  ```
102
102
 
@@ -109,7 +109,7 @@ pdf.remove_field(:last_name)
109
109
  ```ruby
110
110
  # get an array of all field names in the document
111
111
  # output example: [:first_name, :last_name]
112
- pdf.keys
112
+ pdf.names
113
113
  ```
114
114
 
115
115
  ```ruby
@@ -122,24 +122,25 @@ Once the PDF is filled out you can either overwrite it or save it as another fil
122
122
 
123
123
  ```ruby
124
124
  pdf.save
125
-
126
125
  pdf.save_as('output.pdf')
127
126
  ```
128
127
 
129
128
  Or if you prefer to flatten the file (i.e. make it non-editable), you can instead use:
130
129
 
131
130
  ```ruby
132
- pdf.save(true)
133
-
134
- pdf.save_as('output.pdf', true)
131
+ pdf.save(flatten: true)
132
+ pdf.save_as('output.pdf', flatten: true)
135
133
  ```
136
134
 
135
+ **NOTE:** Saving the file automatically closes the input file, so you would need to reinitialize the `FillabePDF` class before making any more changes or saving another copy.
137
136
 
138
137
  ## Example
139
138
 
140
- The following example [test.rb](test/test.rb) and the input file [input.pdf](test/input.pdf) are located in the `test` directory. It uses all of the methods that are described above and generates the output file [output.pdf](test/output.pdf).
139
+ The following example [example.rb](example/run.rb) and the input file [input.pdf](example/input.pdf) are located in the `test` directory. It uses all of the methods that are described above and generates the output files [output.pdf](example/output.pdf) and [output.flat.pdf](example/output.flat.pdf).
141
140
 
142
141
  ```ruby
142
+ require 'fillable-pdf'
143
+
143
144
  # opening a fillable PDF
144
145
  pdf = FillablePDF.new('input.pdf')
145
146
 
@@ -159,12 +160,12 @@ pdf.set_fields(football: 'Yes', baseball: 'Yes',
159
160
  pdf.set_field(:date, Time.now.strftime('%B %e, %Y'))
160
161
 
161
162
  # list of fields
162
- puts "Fields hash: #{pdf.get_fields}"
163
+ puts "Fields hash: #{pdf.fields}"
163
164
 
164
165
  puts
165
166
 
166
- # list of field keys
167
- puts "Keys: #{pdf.keys}"
167
+ # list of field names
168
+ puts "Keys: #{pdf.names}"
168
169
 
169
170
  puts
170
171
 
@@ -174,10 +175,10 @@ puts "Values: #{pdf.values}"
174
175
  puts
175
176
 
176
177
  # Checking field type
177
- if pdf.get_field_type(:football) == Field::CHECKBOX
178
- puts "Field 'football' is of type CHECKBOX"
178
+ if pdf.field_type(:football) == Field::BUTTON
179
+ puts "Field 'football' is of type BUTTON"
179
180
  else
180
- puts "Field 'football' is not of type CHECKBOX"
181
+ puts "Field 'football' is not of type BUTTON"
181
182
  end
182
183
 
183
184
  puts
@@ -185,45 +186,44 @@ puts
185
186
  # Renaming field
186
187
  pdf.rename_field :last_name, :surname
187
188
  puts "Renamed field 'last_name' to 'surname'"
188
- puts "New keys: #{pdf.keys}"
189
189
 
190
190
  puts
191
191
 
192
192
  # Removing field
193
193
  pdf.remove_field :nascar
194
194
  puts "Removed field 'nascar'"
195
- puts "New keys: #{pdf.keys}"
196
-
197
195
  puts
198
196
 
199
197
  # printing the name of the person used inside the PDF
200
- puts "Signatory: #{pdf.get_field(:first_name)} #{pdf.get_field(:last_name)}"
198
+ puts "Signatory: #{pdf.field(:first_name)} #{pdf.field(:last_name)}"
201
199
 
202
- # saving the filled out PDF in another file and making it non-editable
203
- pdf.save_as('output.pdf', true)
200
+ # saving the filled out PDF in another file
201
+ pdf.save_as('output.pdf')
204
202
 
203
+ # saving another copy of the filled out PDF in another file and making it non-editable
204
+ pdf = FillablePDF.new('output.pdf')
205
+ pdf.save_as 'output.flat.pdf', flatten: true
205
206
  ```
206
207
 
207
- The example above produces the following output and also generates the output file [output.pdf](test/output.pdf).
208
+ The example above produces the following output and also generates the output file [output.pdf](example/output.pdf).
208
209
 
209
- The form has a total of 8 fields.
210
-
211
- Fields hash: {:last_name=>"Rahl", :first_name=>"Richard", :football=>"Yes", :baseball=>"Yes", :basketball=>"Yes", :nascar=>"Yes", :hockey=>"Yes", :date=>"July 19, 2017"}
212
-
213
- Keys: [:last_name, :first_name, :football, :baseball, :basketball, :nascar, :hockey, :date]
214
-
215
- Values: ["Rahl", "Richard", "Yes", "Yes", "Yes", "Yes", "Yes", "July 19, 2017"]
216
-
217
- Field 'football' is of type CHECKBOX
218
-
219
- Renamed field 'last_name' to 'surname'
220
- New keys: [:first_name, :football, :baseball, :basketball, :nascar, :hockey, :date, :surname]
221
-
222
- Removed field 'nascar'
223
- New keys: [:first_name, :football, :baseball, :basketball, :hockey, :date, :surname]
224
-
225
- Signatory: Richard
210
+ ```
211
+ The form has a total of 8 fields.
226
212
 
213
+ Fields hash: {:last_name=>"Rahl", :first_name=>"Richard", :football=>"Yes", :baseball=>"Yes", :basketball=>"Yes", :nascar=>"Yes", :hockey=>"Yes", :date=>"August 30, 2019"}
214
+
215
+ Keys: [:last_name, :first_name, :football, :baseball, :basketball, :nascar, :hockey, :date]
216
+
217
+ Values: ["Rahl", "Richard", "Yes", "Yes", "Yes", "Yes", "Yes", "August 30, 2019"]
218
+
219
+ Field 'football' is of type BUTTON
220
+
221
+ Renamed field 'last_name' to 'surname'
222
+
223
+ Removed field 'nascar'
224
+
225
+ Signatory: Richard Rahl
226
+ ```
227
227
 
228
228
  ## Contributing
229
229
 
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
1
  require 'bundler/gem_tasks'
2
- task default: :spec
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('../lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'fillable-pdf/version'
4
4
 
@@ -13,11 +13,16 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/vkononov/fillable-pdf'
14
14
  spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(example|test|spec|features)/}) }
18
+ end
17
19
  spec.bindir = 'exe'
18
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
21
  spec.require_paths = %w[ext lib]
20
22
 
21
- spec.requirements << '>= JDK 5.0'
22
- spec.add_runtime_dependency 'rjb', '~> 1.5'
23
+ spec.add_development_dependency 'bundler', '~> 2.0'
24
+ spec.add_development_dependency 'minitest', '~> 5.0'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+
27
+ spec.add_runtime_dependency 'rjb', '~> 1.6'
23
28
  end
@@ -1,14 +1,10 @@
1
1
  require_relative 'fillable-pdf/itext'
2
2
 
3
3
  class Field
4
- ACRO_FIELDS = Rjb.import('com.itextpdf.text.pdf.AcroFields')
4
+ PDF_NAME = Rjb.import('com.itextpdf.kernel.pdf.PdfName')
5
5
 
6
- CHECKBOX = ACRO_FIELDS.FIELD_TYPE_CHECKBOX
7
- COMBO = ACRO_FIELDS.FIELD_TYPE_COMBO
8
- LIST = ACRO_FIELDS.FIELD_TYPE_LIST
9
- NONE = ACRO_FIELDS.FIELD_TYPE_NONE
10
- PUSHBUTTON = ACRO_FIELDS.FIELD_TYPE_PUSHBUTTON
11
- RADIOBUTTON = ACRO_FIELDS.FIELD_TYPE_RADIOBUTTON
12
- SIGNATURE = ACRO_FIELDS.FIELD_TYPE_SIGNATURE
13
- TEXT = ACRO_FIELDS.FIELD_TYPE_TEXT
6
+ BUTTON = PDF_NAME.Btn.toString
7
+ CHOICE = PDF_NAME.Ch.toString
8
+ SIGNATURE = PDF_NAME.Sig.toString
9
+ TEXT = PDF_NAME.Tx.toString
14
10
  end
@@ -4,20 +4,27 @@ require 'securerandom'
4
4
 
5
5
  class FillablePDF
6
6
  # required Java imports
7
- BYTE_STREAM = Rjb.import('java.io.ByteArrayOutputStream')
8
- FILE_READER = Rjb.import('com.itextpdf.text.pdf.PdfReader')
9
- PDF_STAMPER = Rjb.import('com.itextpdf.text.pdf.PdfStamper')
7
+ BYTE_STREAM = Rjb.import 'com.itextpdf.io.source.ByteArrayOutputStream'
8
+ PDF_READER = Rjb.import 'com.itextpdf.kernel.pdf.PdfReader'
9
+ PDF_WRITER = Rjb.import 'com.itextpdf.kernel.pdf.PdfWriter'
10
+ PDF_DOCUMENT = Rjb.import 'com.itextpdf.kernel.pdf.PdfDocument'
11
+ PDF_ACRO_FORM = Rjb.import 'com.itextpdf.forms.PdfAcroForm'
12
+ PDF_FORM_FIELD = Rjb.import 'com.itextpdf.forms.fields.PdfFormField'
10
13
 
11
14
  ##
12
- # Opens a given fillable PDF file and prepares it for modification.
15
+ # Opens a given fillable-pdf PDF file and prepares it for modification.
13
16
  #
14
- # @param [String] file the name of the PDF file or file path
17
+ # @param [String|Symbol] file_path the name of the PDF file or file path
15
18
  #
16
- def initialize(file)
17
- @file = file
19
+ def initialize(file_path)
20
+ raise IOError, "File at `#{file_path}' is not found" unless File.exist?(file_path)
21
+ @file_path = file_path
18
22
  @byte_stream = BYTE_STREAM.new
19
- @pdf_stamper = PDF_STAMPER.new FILE_READER.new(@file), @byte_stream
20
- @acro_fields = @pdf_stamper.getAcroFields
23
+ @pdf_reader = PDF_READER.new @file_path
24
+ @pdf_writer = PDF_WRITER.new @byte_stream
25
+ @pdf_doc = PDF_DOCUMENT.new @pdf_reader, @pdf_writer
26
+ @pdf_form = PDF_ACRO_FORM.getAcroForm(@pdf_doc, true)
27
+ @form_fields = @pdf_form.getFormFields
21
28
  end
22
29
 
23
30
  ##
@@ -26,7 +33,7 @@ class FillablePDF
26
33
  # @return true if form has fields, false otherwise
27
34
  #
28
35
  def any_fields?
29
- num_fields > 0
36
+ num_fields.positive?
30
37
  end
31
38
 
32
39
  ##
@@ -35,29 +42,31 @@ class FillablePDF
35
42
  # @return the number of fields
36
43
  #
37
44
  def num_fields
38
- @acro_fields.getFields.size
45
+ @form_fields.size
39
46
  end
40
47
 
41
48
  ##
42
49
  # Retrieves the value of a field given its unique field name.
43
50
  #
44
- # @param [String] key the field name
51
+ # @param [String|Symbol] key the field name
45
52
  #
46
53
  # @return the value of the field
47
54
  #
48
- def get_field(key)
49
- @acro_fields.getField key.to_s
55
+ def field(key)
56
+ pdf_field(key).getValueAsString
57
+ rescue NoMethodError
58
+ raise "unknown key name `#{key}'"
50
59
  end
51
60
 
52
61
  ##
53
62
  # Retrieves the numeric type of a field given its unique field name.
54
63
  #
55
- # @param [String] key the field name
64
+ # @param [String|Symbol] key the field name
56
65
  #
57
66
  # @return the type of the field
58
67
  #
59
- def get_field_type(key)
60
- @acro_fields.getFieldType key.to_s
68
+ def field_type(key)
69
+ pdf_field(key).getFormType.toString
61
70
  end
62
71
 
63
72
  ##
@@ -65,12 +74,12 @@ class FillablePDF
65
74
  #
66
75
  # @return the hash of field keys and values
67
76
  #
68
- def get_fields
69
- iterator = @acro_fields.getFields.keySet.iterator
77
+ def fields
78
+ iterator = @form_fields.keySet.iterator
70
79
  map = {}
71
80
  while iterator.hasNext
72
81
  key = iterator.next.toString
73
- map[key.to_sym] = get_field key
82
+ map[key.to_sym] = field(key)
74
83
  end
75
84
  map
76
85
  end
@@ -78,11 +87,11 @@ class FillablePDF
78
87
  ##
79
88
  # Sets the value of a field given its unique field name and value.
80
89
  #
81
- # @param [String] key the field name
82
- # @param [String] value the field value
90
+ # @param [String|Symbol] key the field name
91
+ # @param [String|Symbol] value the field value
83
92
  #
84
93
  def set_field(key, value)
85
- @acro_fields.setField key.to_s, value.to_s
94
+ pdf_field(key).setValue(value.to_s)
86
95
  end
87
96
 
88
97
  ##
@@ -97,20 +106,20 @@ class FillablePDF
97
106
  ##
98
107
  # Renames a field given its unique field name and the new field name.
99
108
  #
100
- # @param [String] old_key the field name
101
- # @param [String] new_key the field name
109
+ # @param [String|Symbol] old_key the field name
110
+ # @param [String|Symbol] new_key the field name
102
111
  #
103
112
  def rename_field(old_key, new_key)
104
- @acro_fields.renameField old_key.to_s, new_key.to_s
113
+ pdf_field(old_key).setFieldName(new_key.to_s)
105
114
  end
106
115
 
107
116
  ##
108
117
  # Removes a field from the document given its unique field name.
109
118
  #
110
- # @param [String] key the field name
119
+ # @param [String|Symbol] key the field name
111
120
  #
112
121
  def remove_field(key)
113
- @acro_fields.removeField key.to_s
122
+ @pdf_form.removeField(key.to_s)
114
123
  end
115
124
 
116
125
  ##
@@ -118,8 +127,8 @@ class FillablePDF
118
127
  #
119
128
  # @return array of field names
120
129
  #
121
- def keys
122
- iterator = @acro_fields.getFields.keySet.iterator
130
+ def names
131
+ iterator = @form_fields.keySet.iterator
123
132
  set = []
124
133
  set << iterator.next.toString.to_sym while iterator.hasNext
125
134
  set
@@ -131,9 +140,9 @@ class FillablePDF
131
140
  # @return array of field values
132
141
  #
133
142
  def values
134
- iterator = @acro_fields.getFields.keySet.iterator
143
+ iterator = @form_fields.keySet.iterator
135
144
  set = []
136
- set << get_field(iterator.next.toString) while iterator.hasNext
145
+ set << field(iterator.next.toString) while iterator.hasNext
137
146
  set
138
147
  end
139
148
 
@@ -142,20 +151,20 @@ class FillablePDF
142
151
  #
143
152
  # @param [bool] flatten true if PDF should be flattened, false otherwise
144
153
  #
145
- def save(flatten = false)
154
+ def save(flatten: false)
146
155
  tmp_file = SecureRandom.uuid
147
- save_as(tmp_file, flatten)
148
- File.rename tmp_file, @file
156
+ save_as(tmp_file, flatten: flatten)
157
+ File.rename tmp_file, @file_path
149
158
  end
150
159
 
151
160
  ##
152
161
  # Saves the filled out PDF file with a given file and flattens it if requested.
153
162
  #
154
- # @param [String] file the name of the PDF file or file path
155
- # @param [bool] flatten true if PDF should be flattened, false otherwise
163
+ # @param [String] file_path the name of the PDF file or file path
164
+ # @param [Hash] flatten: true if PDF should be flattened, false otherwise
156
165
  #
157
- def save_as(file, flatten = false)
158
- File.open(file, 'wb') { |f| f.write(finalize(flatten)) && f.close }
166
+ def save_as(file_path, flatten: false)
167
+ File.open(file_path, 'wb') { |f| f.write(finalize(flatten: flatten)) && f.close }
159
168
  end
160
169
 
161
170
  private
@@ -163,11 +172,17 @@ class FillablePDF
163
172
  ##
164
173
  # Writes the contents of the modified fields to the previously opened PDF file.
165
174
  #
166
- # @param [bool] flatten true if PDF should be flattened, false otherwise
175
+ # @param [Hash] flatten: true if PDF should be flattened, false otherwise
167
176
  #
168
- def finalize(flatten)
169
- @pdf_stamper.setFormFlattening flatten
170
- @pdf_stamper.close
177
+ def finalize(flatten: false)
178
+ @pdf_form.flattenFields if flatten
179
+ @pdf_doc.close
171
180
  @byte_stream.toByteArray
172
181
  end
182
+
183
+ def pdf_field(key)
184
+ field = @form_fields.get(key.to_s)
185
+ raise "unknown key name `#{key}'" if field.nil?
186
+ field
187
+ end
173
188
  end
@@ -1,4 +1,3 @@
1
1
  require 'rjb'
2
2
 
3
- # http://github.com/itext/itextpdf/releases/latest
4
- Rjb.load(File.expand_path('../../ext/itext5-itextpdf-5.5.12.jar', __dir__))
3
+ Rjb.load(Dir.glob(File.expand_path('../../ext/*.jar', __dir__)).join(':'))
@@ -1,3 +1,3 @@
1
- module FillablePDF
2
- VERSION = '0.6'.freeze
1
+ class FillablePDF
2
+ VERSION = '0.7'
3
3
  end
metadata CHANGED
@@ -1,29 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fillable-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Kononov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2019-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: rjb
15
57
  requirement: !ruby/object:Gem::Requirement
16
58
  requirements:
17
59
  - - "~>"
18
60
  - !ruby/object:Gem::Version
19
- version: '1.5'
61
+ version: '1.6'
20
62
  type: :runtime
21
63
  prerelease: false
22
64
  version_requirements: !ruby/object:Gem::Requirement
23
65
  requirements:
24
66
  - - "~>"
25
67
  - !ruby/object:Gem::Version
26
- version: '1.5'
68
+ version: '1.6'
27
69
  description: FillablePDF is an extremely simple and lightweight utility that bridges
28
70
  iText and Ruby in order to fill out fillable PDF forms or extract field values from
29
71
  previously filled out PDF forms.
@@ -34,13 +76,20 @@ extensions: []
34
76
  extra_rdoc_files: []
35
77
  files:
36
78
  - ".gitignore"
79
+ - ".rubocop.yml"
80
+ - ".travis.yml"
37
81
  - Gemfile
38
82
  - LICENSE.txt
39
83
  - README.md
40
84
  - Rakefile
41
85
  - bin/console
42
86
  - bin/setup
43
- - ext/itext5-itextpdf-5.5.12.jar
87
+ - ext/forms-7.1.7.jar
88
+ - ext/io-7.1.7.jar
89
+ - ext/kernel-7.1.7.jar
90
+ - ext/layout-7.1.7.jar
91
+ - ext/slf4j-api-1.7.28.jar
92
+ - ext/slf4j-simple-1.7.28.jar
44
93
  - fillable-pdf.gemspec
45
94
  - lib/field.rb
46
95
  - lib/fillable-pdf.rb
@@ -65,10 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
114
  - - ">="
66
115
  - !ruby/object:Gem::Version
67
116
  version: '0'
68
- requirements:
69
- - ">= JDK 5.0"
70
- rubyforge_project:
71
- rubygems_version: 2.6.13
117
+ requirements: []
118
+ rubygems_version: 3.0.3
72
119
  signing_key:
73
120
  specification_version: 4
74
121
  summary: Fill out or extract field values from simple fillable PDF forms using iText.