pdf-forms 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pdf_forms.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  require 'pdf_forms/version'
2
4
  require 'pdf_forms/safe_path'
3
5
  require 'pdf_forms/fdf'
data/lib/pdf_forms/fdf.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  module PdfForms
2
4
 
3
5
  # Map keys and values to Adobe's FDF format.
@@ -35,15 +37,20 @@ module PdfForms
35
37
  # I have yet to see a version of pdftk which can handle UTF8 input,
36
38
  # so we convert to ISO-8859-15 here, replacing unknown / invalid chars
37
39
  # with the default replacement which is '?'.
38
- if fdf.respond_to?(:encode) # 1.9 onwards
40
+ if fdf.respond_to?(:encode!)
41
+ # Ruby >= 1.9
39
42
  fdf.encode!('ISO-8859-15', :invalid => :replace, :undef => :replace)
43
+ else
44
+ # pre 1.9
45
+ require 'iconv'
46
+ fdf = Iconv.conv('ISO-8859-15//IGNORE', 'utf-8', fdf)
40
47
  end
41
48
  return fdf
42
49
  end
43
50
 
44
51
  # write fdf content to path
45
52
  def save_to(path)
46
- (File.open(path, 'w') << to_fdf).close
53
+ (File.open(path, 'wb') << to_fdf).close
47
54
  end
48
55
 
49
56
  protected
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  module PdfForms
2
4
  class Field
3
5
 
data/lib/pdf_forms/pdf.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  require 'pdf_forms/field'
2
4
 
3
5
  module PdfForms
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  require 'tempfile'
2
4
  module PdfForms
3
5
  class PdftkError < StandardError
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  module PdfForms
2
4
 
3
5
  module SafePath
@@ -1,3 +1,5 @@
1
+ # coding: UTF-8
2
+
1
3
  module PdfForms
2
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
3
5
  end
metadata CHANGED
@@ -1,55 +1,33 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pdf-forms
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 13
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 3
10
+ version: 0.5.3
6
11
  platform: ruby
7
- authors:
8
- - Jens Krämer
12
+ authors:
13
+ - "Jens Kr\xC3\xA4mer"
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-03-07 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: pry
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>'
20
- - !ruby/object:Gem::Version
21
- version: '0.0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>'
28
- - !ruby/object:Gem::Version
29
- version: '0.0'
30
- - !ruby/object:Gem::Dependency
31
- name: pry-nav
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>'
36
- - !ruby/object:Gem::Version
37
- version: '0.0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>'
44
- - !ruby/object:Gem::Version
45
- version: '0.0'
17
+
18
+ date: 2013-03-07 00:00:00 Z
19
+ dependencies: []
20
+
46
21
  description: Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).
47
- email:
22
+ email:
48
23
  - jk@jkraemer.net
49
24
  executables: []
25
+
50
26
  extensions: []
27
+
51
28
  extra_rdoc_files: []
52
- files:
29
+
30
+ files:
53
31
  - lib/pdf_forms/fdf.rb
54
32
  - lib/pdf_forms/field.rb
55
33
  - lib/pdf_forms/pdf.rb
@@ -61,26 +39,38 @@ files:
61
39
  - README.rdoc
62
40
  homepage: http://github.com/jkraemer/pdf-forms
63
41
  licenses: []
42
+
64
43
  post_install_message:
65
44
  rdoc_options: []
66
- require_paths:
45
+
46
+ require_paths:
67
47
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
69
49
  none: false
70
- requirements:
71
- - - ! '>='
72
- - !ruby/object:Gem::Version
73
- version: '0'
74
- required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
58
  none: false
76
- requirements:
77
- - - ! '>='
78
- - !ruby/object:Gem::Version
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 23
63
+ segments:
64
+ - 1
65
+ - 3
66
+ - 6
79
67
  version: 1.3.6
80
68
  requirements: []
69
+
81
70
  rubyforge_project: pdf-forms
82
- rubygems_version: 1.8.23
71
+ rubygems_version: 1.8.25
83
72
  signing_key:
84
73
  specification_version: 3
85
74
  summary: Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).
86
75
  test_files: []
76
+