pdf-forms 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pdf_forms/field.rb +11 -5
- data/lib/pdf_forms/pdftk_wrapper.rb +6 -10
- data/lib/pdf_forms/version.rb +1 -1
- metadata +19 -41
data/lib/pdf_forms/field.rb
CHANGED
@@ -9,19 +9,25 @@ module PdfForms
|
|
9
9
|
# FieldJustification: Left
|
10
10
|
# FieldStateOption: Ja
|
11
11
|
# FieldStateOption: Off
|
12
|
+
#
|
13
|
+
# Represenation of a PDF Form Field
|
12
14
|
def initialize(field_description)
|
13
15
|
field_description.each_line do |line|
|
14
16
|
case line
|
15
|
-
when /FieldType:\s*(.+?)\s*$/
|
16
|
-
@type = $1
|
17
|
-
when /FieldName:\s*(.+?)\s*$/
|
18
|
-
@name = $1
|
19
17
|
when /FieldStateOption:\s*(.*?)\s*$/
|
20
18
|
(@options ||= []) << $1
|
19
|
+
else
|
20
|
+
key, value = line.chomp.split(':').map(&:strip)
|
21
|
+
var_name = key.gsub(/Field/, '').downcase
|
22
|
+
unless self.respond_to?(var_name)
|
23
|
+
self.class.send(:define_method, var_name.to_sym, Proc.new{ instance_variable_get("@#{var_name}".to_sym) } ) # in case new or unknown fields crop up...
|
24
|
+
end
|
25
|
+
instance_variable_set("@#{key.gsub(/Field/, '').downcase}".to_sym, value)
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
25
|
-
|
30
|
+
# Common Fields
|
31
|
+
attr_reader :name, :type, :options, :flags, :justification, :value, :valuedefault
|
26
32
|
end
|
27
33
|
end
|
@@ -61,21 +61,17 @@ module PdfForms
|
|
61
61
|
%x{#{pdftk_command args}}
|
62
62
|
end
|
63
63
|
|
64
|
-
#
|
64
|
+
# concatenate documents
|
65
|
+
#
|
66
|
+
# args: in_file1, in_file2, ... , in_file_n, output
|
65
67
|
def cat(*args)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
input = input_array.map{|path| safe_path(path)}
|
70
|
-
output = safe_path(output_file)
|
71
|
-
call_pdftk(*([input, 'output', output].flatten))
|
68
|
+
arguments = args.flatten.compact.map{|path| safe_path(path)}
|
69
|
+
output = arguments.pop
|
70
|
+
call_pdftk(*([arguments, 'output', output].flatten))
|
72
71
|
end
|
73
72
|
|
74
73
|
protected
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
75
|
def pdftk_command(*args)
|
80
76
|
quote_path(pdftk) + " #{args.flatten.compact.join ' '} 2>&1"
|
81
77
|
end
|
data/lib/pdf_forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,33 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf-forms
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 4
|
10
|
-
version: 0.5.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Jens Krämer
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2013-03-15 00:00:00 Z
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).
|
22
|
-
email:
|
15
|
+
email:
|
23
16
|
- jk@jkraemer.net
|
24
17
|
executables: []
|
25
|
-
|
26
18
|
extensions: []
|
27
|
-
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- lib/pdf-forms.rb
|
32
22
|
- lib/pdf_forms/fdf.rb
|
33
23
|
- lib/pdf_forms/field.rb
|
@@ -40,38 +30,26 @@ files:
|
|
40
30
|
- README.rdoc
|
41
31
|
homepage: http://github.com/jkraemer/pdf-forms
|
42
32
|
licenses: []
|
43
|
-
|
44
33
|
post_install_message:
|
45
34
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
35
|
+
require_paths:
|
48
36
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
38
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
44
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
hash: 23
|
64
|
-
segments:
|
65
|
-
- 1
|
66
|
-
- 3
|
67
|
-
- 6
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
68
48
|
version: 1.3.6
|
69
49
|
requirements: []
|
70
|
-
|
71
50
|
rubyforge_project: pdf-forms
|
72
|
-
rubygems_version: 1.8.
|
51
|
+
rubygems_version: 1.8.23
|
73
52
|
signing_key:
|
74
53
|
specification_version: 3
|
75
54
|
summary: Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).
|
76
55
|
test_files: []
|
77
|
-
|