pdf-toolkit 1.0.0.rc1 → 1.1.0
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 +7 -0
- data/README.md +2 -6
- data/lib/pdf/toolkit.rb +8 -2
- data/lib/pdf/toolkit/native.rb +2 -2
- metadata +12 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9004fb28bed61ec881435af57d9075120fdae211
|
4
|
+
data.tar.gz: 3b26b99535378c608a5de9bb3f0989c7baef370f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 905a816834818cefc7708a09a97498b76804d7b3b8defaf6d65fc577a25942a488e7e16fccb494d3837f36552d101d8df40aff778d984781af168694659eee7e
|
7
|
+
data.tar.gz: ae6acfe55d460e0c316f1fa952b80087220c4742db21d22020a672fd56ba7c8d4cde9f9b6f1f49b2c5fd9d1c35d6da90311e439ba24ecc4c07d364d9e456bdd5
|
data/README.md
CHANGED
@@ -22,18 +22,14 @@ A typical usecase is as follows:
|
|
22
22
|
|
23
23
|
## Note about this version
|
24
24
|
|
25
|
-
|
26
|
-
difference (broken API) with the 0.5.0 branch is that support for ActiveRecord
|
27
|
-
has been entirely removed (mostly because the implementation was ugly so far).
|
28
|
-
If you use pdf-toolkit and would like activerecord to be included in 1.0.0,
|
29
|
-
please just tell us and we'll add it. If you upgrade from 0.5.0 to 1.0.0.rc1 and
|
30
|
-
something else goes wrong, please report the issue on github.
|
25
|
+
Version 1.1.0 requires PDFTK version 2.0
|
31
26
|
|
32
27
|
## Contributors
|
33
28
|
|
34
29
|
* Tim Pope is the original author of pdf-toolkit
|
35
30
|
* Preston Marshall ported the project to github
|
36
31
|
* Bernard Lambeau is the current maintainer
|
32
|
+
* James Prior made small changes for PDFtk Server 2.0
|
37
33
|
|
38
34
|
Please report issues on [github](https://github.com/blambeau/pdf-toolkit/issues)
|
39
35
|
|
data/lib/pdf/toolkit.rb
CHANGED
@@ -43,7 +43,7 @@ end unless defined? PDF
|
|
43
43
|
class PDF::Toolkit
|
44
44
|
extend Forwardable
|
45
45
|
|
46
|
-
VERSION = "1.
|
46
|
+
VERSION = "1.1.0"
|
47
47
|
|
48
48
|
# Raised when something fails with the toolkit
|
49
49
|
class Error < ::StandardError; end
|
@@ -314,6 +314,10 @@ class PDF::Toolkit
|
|
314
314
|
end
|
315
315
|
retval = call_pdftk_on_file("dump_data","output","-", :mode => "r") do |pipe|
|
316
316
|
pipe.each_line do |line|
|
317
|
+
|
318
|
+
# For PDFTK 2.0, ignore the begin line
|
319
|
+
next if line =~ /Begin\n$/
|
320
|
+
|
317
321
|
match = line.chomp.match(/(.*?): (.*)/)
|
318
322
|
unless match
|
319
323
|
raise ExecutionError, "Error parsing PDFTK output"
|
@@ -357,7 +361,8 @@ class PDF::Toolkit
|
|
357
361
|
# ensure_loaded
|
358
362
|
raise Error, "No data to update PDF with" unless @new_info
|
359
363
|
tmp = ( out == @filename ? "#{out}.#{$$}.new" : nil)
|
360
|
-
|
364
|
+
# # NEW FOR PDFTK 2.0, was just update_info
|
365
|
+
args = ["update_info_utf8","-","output",tmp || out]
|
361
366
|
args += [ "owner_pw", @owner_password ] if @owner_password
|
362
367
|
args += [ "user_pw" , @user_password ] if @user_password
|
363
368
|
args += (["allow"] + @permissions.uniq ) if @permissions && !@permissions.empty?
|
@@ -367,6 +372,7 @@ class PDF::Toolkit
|
|
367
372
|
# metadata in order to modify the file.
|
368
373
|
retval = call_pdftk_on_file(*args) do |io|
|
369
374
|
(@info || {}).merge(@new_info).each do |key,value|
|
375
|
+
io.puts "InfoBegin" # NEW FOR PDFTK 2.0
|
370
376
|
io.puts "InfoKey: #{key}"
|
371
377
|
io.puts "InfoValue: #{format_field(value)}"
|
372
378
|
end
|
data/lib/pdf/toolkit/native.rb
CHANGED
@@ -12,14 +12,14 @@ class PDF::Toolkit
|
|
12
12
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
13
13
|
args << "dont_ask"
|
14
14
|
args << options
|
15
|
-
result = call_program(
|
15
|
+
result = call_program("pdftk",*args,&block)
|
16
16
|
return block_given? ? $?.success? : result
|
17
17
|
end
|
18
18
|
|
19
19
|
# Invoke +pdftotext+. If +outfile+ is omitted, returns an +IO+ object for
|
20
20
|
# the output.
|
21
21
|
def pdftotext(file,outfile = nil,&block)
|
22
|
-
call_program(
|
22
|
+
call_program("pdftotext",file,
|
23
23
|
outfile||"-",:mode => (outfile ? nil : 'r'),&block)
|
24
24
|
end
|
25
25
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease: 6
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tim Pope
|
@@ -10,7 +9,7 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description: PDF::Toolkit provides a simple interface for querying and unpdation PDF
|
16
15
|
metadata like the document Author and Title.
|
@@ -21,41 +20,37 @@ executables: []
|
|
21
20
|
extensions: []
|
22
21
|
extra_rdoc_files: []
|
23
22
|
files:
|
24
|
-
- Rakefile
|
25
23
|
- README.md
|
26
|
-
-
|
24
|
+
- Rakefile
|
25
|
+
- lib/pdf/toolkit.rb
|
27
26
|
- lib/pdf/toolkit/class_methods.rb
|
28
27
|
- lib/pdf/toolkit/coercions.rb
|
29
28
|
- lib/pdf/toolkit/native.rb
|
30
|
-
-
|
29
|
+
- pdf-toolkit.gemspec
|
30
|
+
- test/pdf_toolkit_test.rb
|
31
31
|
- test/pdfs/blank.pdf
|
32
32
|
- test/test_coercions.rb
|
33
|
-
- test/pdf_toolkit_test.rb
|
34
33
|
homepage: http://pdf-toolkit.rubyforge.org
|
35
34
|
licenses: []
|
35
|
+
metadata: {}
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
40
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
41
|
requirements:
|
43
|
-
- -
|
42
|
+
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
hash: 1012145491
|
49
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
46
|
requirements:
|
52
|
-
- -
|
47
|
+
- - ">="
|
53
48
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
49
|
+
version: '0'
|
55
50
|
requirements: []
|
56
51
|
rubyforge_project: pdf-toolkit
|
57
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.2.2
|
58
53
|
signing_key:
|
59
|
-
specification_version:
|
54
|
+
specification_version: 4
|
60
55
|
summary: A wrapper around pdftk to allow PDF metadata manipulation
|
61
56
|
test_files: []
|