fillable-pdf 0.1.0 → 0.1.1

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
2
  SHA1:
3
- metadata.gz: 7da9c03f8ee095a61b7a95a206be382fa4b5d1d5
4
- data.tar.gz: 1fcfa10679b928734cf5628fe063e0c60b739e23
3
+ metadata.gz: 476917341eb1db165e3aa0b7707c1db15ff37da3
4
+ data.tar.gz: 2b544131afb874e52e1d67dc0074cc66bafbc9d3
5
5
  SHA512:
6
- metadata.gz: 0fd914fff82bc757c7c1a521db4c222a314f84cd5e5caf9e10b92286bd877e8b43202b841cb89819efb288be307ae6c8e8dcf5304d21f1f9bce4e60613272b8f
7
- data.tar.gz: 51cde33bf6c621b50487249c30d12bcc1e8f9f1caeda458fd73292fea33f8b999c1d8c786d9bbde9e306cc09eda8368c130e948b7122508953d329bde5ef36e0
6
+ metadata.gz: a59918324b552feb21632ce4f0c132659ba23685836717b9f7fbae4166bca6d80826e16cc1e84cd074155b3be1ee6a17085e2c357ee3308d407b8c80a8ff7c06
7
+ data.tar.gz: c61d56797285475ec09473fcd0896721aa84fa0955abee1cc2b848b656687ba4d8d67a847f1201625c23adb8cc451acc1327784a867130eac1119e37ca90923d
data/README.md CHANGED
@@ -36,11 +36,15 @@ pdf = FillablePDF.new('input.pdf')
36
36
  An instance of `FillablePDF` has the following methods at its disposal:
37
37
 
38
38
  ```ruby
39
- pdf.get_field('full_name')
39
+ pdf.has_fields? # returns true if the form has any fillable fields
40
40
 
41
- pdf.set_field('first_name', 'Richard')
41
+ pdf.num_fields # get the total number of fillable form fields
42
42
 
43
- pdf.set_fields({first_name: 'Richard', last_name: 'Rahl'})
43
+ pdf.get_field('full_name') # retrieve a single field value by field name
44
+
45
+ pdf.set_field('first_name', 'Richard') # set a single field
46
+
47
+ pdf.set_fields({first_name: 'Richard', last_name: 'Rahl'}) # set multiple fields
44
48
  ```
45
49
 
46
50
  Once the PDF is filled out you can either overwrite it or save it as another file:
@@ -48,7 +52,7 @@ Once the PDF is filled out you can either overwrite it or save it as another fil
48
52
  ```ruby
49
53
  pdf.save
50
54
 
51
- pdf.save_as(file)
55
+ pdf.save_as('output.pdf')
52
56
  ```
53
57
 
54
58
  Or if you prefer to flatten the file (i.e. make it non-editable), you can instead use:
@@ -56,13 +60,13 @@ Or if you prefer to flatten the file (i.e. make it non-editable), you can instea
56
60
  ```ruby
57
61
  pdf.save(true)
58
62
 
59
- pdf.save_as(file, true)
63
+ pdf.save_as('output.pdf', true)
60
64
  ```
61
65
 
62
66
 
63
67
  ## Example
64
68
 
65
- For a a fuller usage example of this gem, please see the contents of the `test` directory.
69
+ For a fuller usage example of this gem, please see the contents of the `test` directory.
66
70
 
67
71
 
68
72
  ## Contributing
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = 'Fill out or extract field values from simple fillable PDF forms using iText.'
13
13
  spec.description = '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.'
14
- spec.homepage = 'http://vkononov.github.io/fillable-pdf'
14
+ spec.homepage = 'https://vkononov.github.io/fillable-pdf'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -26,6 +26,26 @@ class FillablePDF
26
26
  end
27
27
 
28
28
 
29
+ ##
30
+ # Determines whether the form has any fields.
31
+ #
32
+ # @return true if form has fields, false otherwise
33
+ #
34
+ def has_fields?
35
+ num_fields > 0
36
+ end
37
+
38
+
39
+ ##
40
+ # Returns the total number of form fields.
41
+ #
42
+ # @return the number of fields
43
+ #
44
+ def num_fields
45
+ @form_fields.getFields.size
46
+ end
47
+
48
+
29
49
  ##
30
50
  # Retrieves the value of a field given its unique field name.
31
51
  #
@@ -1,3 +1,3 @@
1
1
  module FillablePDF
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fillable-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Kononov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,7 +72,7 @@ files:
72
72
  - fillable-pdf.gemspec
73
73
  - lib/fillable-pdf.rb
74
74
  - lib/fillable-pdf/version.rb
75
- homepage: http://vkononov.github.io/fillable-pdf
75
+ homepage: https://vkononov.github.io/fillable-pdf
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}