pdf-forms 1.3.0 → 1.5.0

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
  SHA256:
3
- metadata.gz: 40651e7dd3bdc30c69263f76ecc3883c8be80f985e431509ee51e9d51bc0aa8d
4
- data.tar.gz: 7e0ab952ddd42be27d4a58de7acdda3d7ef54d1588e889432ec3be922ac1b722
3
+ metadata.gz: 34bbe8702aad852cb5da04e3878e430d8468908559a100a20195d454b30a2e7c
4
+ data.tar.gz: e8d3341812c1e303ede2850ec6d8862c4d500676d638766a92d0d773179ed4ad
5
5
  SHA512:
6
- metadata.gz: d12c30fbdeabb1443f33d6f52af39e442241ce44158f9095ca909d3de434caef47df83156ba05ae08169d6bed5840220fb8d80dda673c441c3e414fd64ca3a8e
7
- data.tar.gz: 9a7c21dc930ffe1249258f730cd628bf77a115fd64f84fef5df994fdef5e88e3be227d09e0cdcb862550a8ede7f25afb7fdb73083297f9c0958e998b748f5b6b
6
+ metadata.gz: 7fcdb1df65044548b56599aa49dab727954ec9bf9a72f86b6122c6fbcdc2677ee062c9954ca9bfa71d8015f0b011a7c1b26b58a9699bf483dfa58475b3db92e9
7
+ data.tar.gz: 63edc0c170d42d71f46044fbaccd65da1ba4888c1d87de5f40dad6ab8f50b36aa66ff5bb9222fdc1e4de7c72d0da75c5a59e69614d0900d982e2e51ba1c12643
data/README.md CHANGED
@@ -89,6 +89,9 @@ pdftk.fill_form '/path/to/form.pdf', 'myform.pdf', {foo: 'bar'}, encrypt: true,
89
89
 
90
90
  # you can also protect the PDF even from opening by specifying an additional user_pw option:
91
91
  pdftk.fill_form '/path/to/form.pdf', 'myform.pdf', {foo: 'bar'}, encrypt: true, encrypt_options: 'user_pw secret'
92
+
93
+ # if you are facing font issues with your pdf, you can specify :replacement_font option:
94
+ pdftk.fill_form '/path/to/form.pdf', 'myform.pdf', {foo: 'bar'}, replacement_font: '/path/to/font'
92
95
  ```
93
96
 
94
97
  Any options shown above can also be set when initializing the PdfForms
@@ -103,7 +106,8 @@ In case your form's field names contain HTML entities (like
103
106
 
104
107
  ### Non-ASCII Characters (UTF8 etc) are not displayed in the filled out PDF
105
108
 
106
- First, check if the field value has been stored properly in the output PDF using `pdftk output.pdf dump_data_fields_utf8`.
109
+ First, try to use the `replacement_font` option and specify the font that's not being displayed.
110
+ If it doesn't work, check if the field value has been stored properly in the output PDF using `pdftk output.pdf dump_data_fields_utf8`.
107
111
 
108
112
  If it has been stored but is not rendered, your input PDF lacks the proper font for your kind of characters. Re-create it and embed any necessary fonts.
109
113
  If the value has not been stored, there is a problem with filling out the form, either on your side, of with this gem.
@@ -84,8 +84,20 @@ module PdfForms
84
84
 
85
85
  # returns the commands output, check general execution success with
86
86
  # $?.success?
87
+ #
88
+ # The method will throw a PdftkError if pdftk returns with a non-zero exit
89
+ # code *and* the output contains the word "Error" (case insensitive).
90
+ #
91
+ # This is to satisfy both the requirements of not failing silently in case of
92
+ # PDFtk errors (https://github.com/jkraemer/pdf-forms/issues/80) as well as
93
+ # tolerating non-zero exit codes that are merely warnings
94
+ # (https://github.com/jkraemer/pdf-forms/issues/86)
87
95
  def call_pdftk(*args)
88
- SafeShell.execute pdftk, *(args.flatten)
96
+ output = SafeShell.execute pdftk, *(args.flatten)
97
+ if !$?.success? and output.to_s =~ /Error/i
98
+ raise PdftkError.new("pdftk failed with command\n#{pdftk} #{args.flatten.compact.join ' '}\ncommand output was:\n#{output}")
99
+ end
100
+ return output
89
101
  end
90
102
 
91
103
  # concatenate documents, can optionally specify page ranges
@@ -158,6 +170,9 @@ module PdfForms
158
170
  encrypt_options = encrypt_options.split if String === encrypt_options
159
171
  args << ['encrypt_128bit', 'owner_pw', encrypt_pass, encrypt_options]
160
172
  end
173
+ if option_or_global(:replacement_font, local_options)
174
+ args << ['replacement_font', option_or_global(:replacement_font, local_options)]
175
+ end
161
176
  args.flatten!
162
177
  args.compact!
163
178
  args
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module PdfForms
4
- VERSION = '1.3.0'
4
+ VERSION = '1.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Krämer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-07 00:00:00.000000000 Z
11
+ date: 2023-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cliver
@@ -44,36 +44,57 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rexml
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.2.6
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '3.2'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 3.2.6
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '3.2'
47
67
  - !ruby/object:Gem::Dependency
48
68
  name: bundler
49
69
  requirement: !ruby/object:Gem::Requirement
50
70
  requirements:
51
71
  - - "~>"
52
72
  - !ruby/object:Gem::Version
53
- version: '1.7'
73
+ version: '2.1'
54
74
  type: :development
55
75
  prerelease: false
56
76
  version_requirements: !ruby/object:Gem::Requirement
57
77
  requirements:
58
78
  - - "~>"
59
79
  - !ruby/object:Gem::Version
60
- version: '1.7'
80
+ version: '2.1'
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: rake
63
83
  requirement: !ruby/object:Gem::Requirement
64
84
  requirements:
65
85
  - - "~>"
66
86
  - !ruby/object:Gem::Version
67
- version: '10.0'
87
+ version: '13.0'
68
88
  type: :development
69
89
  prerelease: false
70
90
  version_requirements: !ruby/object:Gem::Requirement
71
91
  requirements:
72
92
  - - "~>"
73
93
  - !ruby/object:Gem::Version
74
- version: '10.0'
94
+ version: '13.0'
75
95
  description: A Ruby frontend to the pdftk binary, including FDF and XFDF creation.
76
- Just pass your template and a hash of data to fill in.
96
+ Also works with the PDFTK Java port. Just pass your template and a hash of data
97
+ to fill in.
77
98
  email:
78
99
  - jk@jkraemer.net
79
100
  executables: []
@@ -97,7 +118,7 @@ homepage: http://github.com/jkraemer/pdf-forms
97
118
  licenses:
98
119
  - MIT
99
120
  metadata: {}
100
- post_install_message:
121
+ post_install_message:
101
122
  rdoc_options: []
102
123
  require_paths:
103
124
  - lib
@@ -112,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
133
  - !ruby/object:Gem::Version
113
134
  version: 1.3.6
114
135
  requirements: []
115
- rubyforge_project: pdf-forms
116
- rubygems_version: 2.7.6.2
117
- signing_key:
136
+ rubygems_version: 3.3.26
137
+ signing_key:
118
138
  specification_version: 4
119
139
  summary: Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).
120
140
  test_files: []