prawn-fillform 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/prawn-fillform/version.rb +1 -1
- data/lib/prawn-fillform.rb +13 -3
- metadata +1 -1
data/lib/prawn-fillform.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'prawn-fillform/version'
|
3
|
+
require 'open-uri'
|
4
|
+
OpenURI::Buffer::StringMax = 0
|
3
5
|
|
4
6
|
module Prawn
|
7
|
+
|
5
8
|
module Fillform
|
6
9
|
|
7
10
|
class Field
|
@@ -177,10 +180,11 @@ module Prawn
|
|
177
180
|
options ||= {}
|
178
181
|
|
179
182
|
if value
|
183
|
+
value = value.to_s
|
180
184
|
if field.type == :text
|
181
185
|
fill_color options[:font_color] || field.font_color
|
182
186
|
|
183
|
-
text_box value
|
187
|
+
text_box value, :at => [field.x + 2, field.y - 1],
|
184
188
|
:align => options[:align] || field.align,
|
185
189
|
:width => options[:width] || field.width,
|
186
190
|
:height => options[:height] || field.height,
|
@@ -190,10 +194,16 @@ module Prawn
|
|
190
194
|
elsif field.type == :button
|
191
195
|
|
192
196
|
bounding_box([field.x, field.y], :width => field.width, :height => field.height) do
|
193
|
-
|
194
|
-
|
197
|
+
if value =~ /http/
|
198
|
+
image open(value), :position => options[:position] || :center,
|
195
199
|
:vposition => options[:vposition] || :center,
|
196
200
|
:fit => options[:fit] || [field.width, field.height]
|
201
|
+
else
|
202
|
+
image value, :position => options[:position] || :center,
|
203
|
+
:vposition => options[:vposition] || :center,
|
204
|
+
:fit => options[:fit] || [field.width, field.height]
|
205
|
+
end
|
206
|
+
|
197
207
|
end
|
198
208
|
end
|
199
209
|
end
|