pdf_form_filler 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pdf_form_filler/form.rb +12 -2
- data/lib/pdf_form_filler/version.rb +1 -1
- metadata +2 -2
data/lib/pdf_form_filler/form.rb
CHANGED
@@ -8,7 +8,17 @@ class PdfFormFiller::Form
|
|
8
8
|
@definition_file = options[:definition]
|
9
9
|
@definition = YAML.load_file(@definition_file)
|
10
10
|
|
11
|
+
# Work around Prawn bug where using a multi-page template
|
12
|
+
# results in 'Error 14' when the generated PDF is opened in
|
13
|
+
# Adobe Reader.
|
14
|
+
#
|
15
|
+
# See: https://github.com/prawnpdf/prawn/issues/364
|
11
16
|
@pdf = Prawn::Document.new(:template => @template)
|
17
|
+
page_count = @pdf.page_count
|
18
|
+
@pdf = Prawn::Document.new(:skip_page_creation => true)
|
19
|
+
1.upto(page_count) do |page_number|
|
20
|
+
@pdf.start_new_page(:template => @template, :template_page => page_number)
|
21
|
+
end
|
12
22
|
|
13
23
|
@pdf.font(File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'fonts', 'LiberationSans-Regular.ttf')))
|
14
24
|
|
@@ -49,7 +59,7 @@ class PdfFormFiller::Form
|
|
49
59
|
if check_box
|
50
60
|
text_align = :center
|
51
61
|
vertical_align = :center
|
52
|
-
font_size = box_coords[3]
|
62
|
+
font_size = box_coords[3]
|
53
63
|
horizontal_padding = 0
|
54
64
|
vertical_padding = 0
|
55
65
|
end
|
@@ -89,7 +99,7 @@ class PdfFormFiller::Form
|
|
89
99
|
local_box_coords = convert_to_local(box_coords)
|
90
100
|
|
91
101
|
if check_box
|
92
|
-
value = (data[name.to_s] || data[name.to_sym]) ? '
|
102
|
+
value = (data[name.to_s] || data[name.to_sym]) ? 'X ' : ''
|
93
103
|
else
|
94
104
|
value = (data[name.to_s] || data[name.to_sym] || '').to_s
|
95
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf_form_filler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: prawn
|