nguyen 1.0.2 → 1.0.3
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.
- checksums.yaml +5 -5
- data/README.md +9 -1
- data/lib/nguyen/fdf.rb +2 -2
- data/lib/nguyen/pdftk_wrapper.rb +3 -3
- data/lib/nguyen/version.rb +2 -2
- data/lib/nguyen/xfdf.rb +2 -2
- metadata +21 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: acfaf8065a261f6cc2b2f5b95887a48d450686b6529a315664982c13ecc0c8d0
|
|
4
|
+
data.tar.gz: 99729f86c46f23fc9846f1af8c727da593066dc9df39c4283eceba5b6bd2bb68
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d65ce412084256c66f6061c32301f4d48772aafd28b438049877191bb93d72592cc13b9727c46d445be4d7cb8d41fb1db2163ba22c1d03d3739fd0a64907d8f
|
|
7
|
+
data.tar.gz: b8ebe36c4cbff4e667b38dad208c305035bfc18623b68bace90ff8753f0a6aa7fb203fcec0332a959b155166c9a646d3cee455bb9601cf26b2abeee9d85f7d07
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ You could download pdftk at http://www.accesspdf.com/pdftk/
|
|
|
7
7
|
Nguyên is a fork of Jens Krämer's pdf-forms with addition of filling forms with XFDF feature.
|
|
8
8
|
|
|
9
9
|
[](http://travis-ci.org/ruby-journal/nguyen)
|
|
10
|
-
[](https://codeclimate.com/github/ruby-journal/nguyen)
|
|
11
11
|
|
|
12
12
|
## EXAMPLE:
|
|
13
13
|
|
|
@@ -49,6 +49,14 @@ pdftk.fill_form('/path/to/form.pdf', 'myform.pdf', fdf)
|
|
|
49
49
|
# with xfdf
|
|
50
50
|
xfdf = Nguyen::Xfdf.new(foo: 'bar')
|
|
51
51
|
pdftk.fill_form('/path/to/form.pdf', 'myform.pdf', xfdf)
|
|
52
|
+
|
|
53
|
+
# will work with xfdf or fdf xml string directly as well
|
|
54
|
+
xfdf_string = <<XML
|
|
55
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
56
|
+
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><fields><field name="foo"><value>bar</value></field></fields></xfdf>
|
|
57
|
+
XML
|
|
58
|
+
# or xfdf_string = Nguyen::Xfdf.new(foo: 'bar').to_xfdf
|
|
59
|
+
pdftk.fill_form('/path/to/form', 'myform.pdf', xfdf_string)
|
|
52
60
|
```
|
|
53
61
|
|
|
54
62
|
## INSTALL:
|
data/lib/nguyen/fdf.rb
CHANGED
data/lib/nguyen/pdftk_wrapper.rb
CHANGED
|
@@ -14,11 +14,11 @@ module Nguyen
|
|
|
14
14
|
@options = options
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# pdftk.fill_form '/path/to/form.pdf', '/path/to/destination.pdf', xfdf_or_fdf_object
|
|
18
|
-
def fill_form(template, destination,
|
|
17
|
+
# pdftk.fill_form '/path/to/form.pdf', '/path/to/destination.pdf', xfdf_or_fdf_object or xfdf_or_fdf_string
|
|
18
|
+
def fill_form(template, destination, form_data)
|
|
19
19
|
tmp = Tempfile.new('pdf_forms-fdf')
|
|
20
20
|
tmp.close
|
|
21
|
-
|
|
21
|
+
form_data.respond_to?(:save_to) ? form_data.save_to(tmp.path) : File.write(tmp.path, form_data)
|
|
22
22
|
command = pdftk_command %Q("#{template}"), 'fill_form', %Q("#{tmp.path}"), 'output', destination, add_options(tmp.path)
|
|
23
23
|
output = %x{#{command}}
|
|
24
24
|
unless File.readable?(destination) && File.size(destination) > 0
|
data/lib/nguyen/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module Nguyen
|
|
2
|
-
VERSION = '1.0.
|
|
3
|
-
end
|
|
2
|
+
VERSION = '1.0.3'
|
|
3
|
+
end
|
data/lib/nguyen/xfdf.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nguyen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trung Lê
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -16,14 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
19
|
+
version: '1.10'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: minitest
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
27
41
|
description: Forms for Nguyên is Ruby library that could merge PDF fields by XFDF/FDF
|
|
28
42
|
via pdftk.
|
|
29
43
|
email: trung.le@ruby-journal.com
|
|
@@ -52,16 +66,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
52
66
|
requirements:
|
|
53
67
|
- - ">="
|
|
54
68
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
69
|
+
version: 2.5.0
|
|
56
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
71
|
requirements:
|
|
58
72
|
- - ">="
|
|
59
73
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
74
|
+
version: '0'
|
|
61
75
|
requirements:
|
|
62
76
|
- pdtk 1.44.1 or newer
|
|
63
|
-
|
|
64
|
-
rubygems_version: 2.2.2
|
|
77
|
+
rubygems_version: 3.0.3
|
|
65
78
|
signing_key:
|
|
66
79
|
specification_version: 4
|
|
67
80
|
summary: Fill out PDF forms by XFDF/FDF via pdftk.
|