pdf-forms 1.4.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: 6f7ed295a6b7127c97a398655de313fcce3950b3ea32b62b31ecafb72993315e
4
- data.tar.gz: 432d25045b4cc7383aa2500cc66da6f7ca058be803965be1fab3dd202be1eff8
3
+ metadata.gz: 34bbe8702aad852cb5da04e3878e430d8468908559a100a20195d454b30a2e7c
4
+ data.tar.gz: e8d3341812c1e303ede2850ec6d8862c4d500676d638766a92d0d773179ed4ad
5
5
  SHA512:
6
- metadata.gz: 439a63e18b1ee43256ca559f6fcd7a34faa9ac2db6ccb807ec91c2378c16bc5db840bb772d6ba59690cd856cb82e98bc814cdade458800dcb6744c3ace4aaaee
7
- data.tar.gz: e6e7e593801b25ad4912e8d3eaf647d27f6ca1aad08ca8a170cee702c9d5781a3353f3fcc7af56f9f94c28a8bcb9b98c6320d9452f05e3c5fea17d86bbd51904
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.4.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.4.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: 2021-11-09 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,6 +44,26 @@ 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
@@ -98,7 +118,7 @@ homepage: http://github.com/jkraemer/pdf-forms
98
118
  licenses:
99
119
  - MIT
100
120
  metadata: {}
101
- post_install_message:
121
+ post_install_message:
102
122
  rdoc_options: []
103
123
  require_paths:
104
124
  - lib
@@ -113,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
133
  - !ruby/object:Gem::Version
114
134
  version: 1.3.6
115
135
  requirements: []
116
- rubygems_version: 3.0.3
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: []