prawn-fillform 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -16,9 +16,9 @@ require 'prawn-fillform'
16
16
 
17
17
  data = {}
18
18
  data[:page_1] = {}
19
- data[:page_1][:firstname] = "Max"
20
- data[:page_1][:lastname] = "Mustermann"
21
- data[:page_1][:photo] = "test.jpg"
19
+ data[:page_1][:firstname] = { :value => "Max" }
20
+ data[:page_1][:lastname] = { :value => "Mustermann" }
21
+ data[:page_1][:photo] = { :value => "test.jpg" }
22
22
 
23
23
  # Create a PDF file with predefined data Fields
24
24
  Prawn::Document.generate "output.pdf", :template => "template.pdf" do |pdf|
data/examples/main.rb CHANGED
@@ -9,9 +9,9 @@ require 'prawn/fillform'
9
9
 
10
10
  data = {}
11
11
  data[:page_1] = {}
12
- data[:page_1][:firstname] = "Max"
13
- data[:page_1][:lastname] = "Mustermann"
14
- data[:page_1][:photo] = "../data/test.jpg"
12
+ data[:page_1][:firstname] = { :value => "Max" }
13
+ data[:page_1][:lastname] = { :value => "Mustermann" }
14
+ data[:page_1][:photo] = { :value => "../data/test.jpg" }
15
15
 
16
16
 
17
17
  Prawn::Document.generate "../data/output.pdf", :template => "../data/template.pdf" do |pdf|
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Prawn
3
3
  module Fillform
4
- VERSION = "0.0.11"
4
+ VERSION = "0.0.12"
5
5
  end
6
6
  end
7
7
 
@@ -128,11 +128,13 @@ module Prawn
128
128
  def collect!
129
129
  @state.pages.each_with_index do |page, i|
130
130
  annots = deref(page.dictionary.data[:Annots])
131
- annots.map do |ref|
132
- reference = {}
133
- reference[:ref] = ref
134
- reference[:annots] = annots
135
- @refs << reference
131
+ if annots
132
+ annots.map do |ref|
133
+ reference = {}
134
+ reference[:ref] = ref
135
+ reference[:annots] = annots
136
+ @refs << reference
137
+ end
136
138
  end
137
139
  end
138
140
 
@@ -167,18 +169,20 @@ module Prawn
167
169
  annots = deref(page.dictionary.data[:Annots])
168
170
  page_number = "page_#{i+1}".to_sym
169
171
  acroform[page_number] = []
170
- annots.map do |ref|
171
- dictionary = deref(ref)
172
-
173
- next unless deref(dictionary[:Type]) == :Annot and deref(dictionary[:Subtype]) == :Widget
174
- next unless (deref(dictionary[:FT]) == :Tx || deref(dictionary[:FT]) == :Btn)
175
-
176
- type = deref(dictionary[:FT]).to_sym
177
- case type
178
- when :Tx
179
- acroform[page_number] << Text.new(dictionary)
180
- when :Btn
181
- acroform[page_number] << Button.new(dictionary)
172
+ if annots
173
+ annots.map do |ref|
174
+ dictionary = deref(ref)
175
+
176
+ next unless deref(dictionary[:Type]) == :Annot and deref(dictionary[:Subtype]) == :Widget
177
+ next unless (deref(dictionary[:FT]) == :Tx || deref(dictionary[:FT]) == :Btn)
178
+
179
+ type = deref(dictionary[:FT]).to_sym
180
+ case type
181
+ when :Tx
182
+ acroform[page_number] << Text.new(dictionary)
183
+ when :Btn
184
+ acroform[page_number] << Button.new(dictionary)
185
+ end
182
186
  end
183
187
  end
184
188
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-fillform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
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: 2011-09-29 00:00:00.000000000Z
12
+ date: 2011-10-07 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: