jpdfunite 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +20 -1
- data/jpdfunite.gemspec +1 -0
- data/lib/jpdfunite/version.rb +1 -1
- data/lib/jpdfunite.rb +3 -2
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c2057d6b3b7b2c81a41fe5e80af09472d320e5b
|
4
|
+
data.tar.gz: f5ed1ebc10eb7ce08798051bcba6a6504e12e24a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbd9f64747deb92f37c2a687957cfac702258138b3dfe9b36be8f8c72ed89f479a2e51ab0e84a261ca531cf3e7810814a2ab553a39246137990dffc3385fe4d9
|
7
|
+
data.tar.gz: 7a6f2bb311e882b443173e54395d673306f1189a2a4edc183008f69fb05839f1d5aaf42bb24d036ef188caa994b5062b3dcae5d266e1033a9d307da4f66eb7cd
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,26 @@ bookmarks to PDF (GPLv3)
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
-
|
35
|
+
This provides three objects and two methods, `PdfFile`, `Section` and `Outline`.
|
36
|
+
`Outline` represents the complete output file and `Section` represents a
|
37
|
+
section. Here is an example that combines three PDF files into one:
|
38
|
+
|
39
|
+
``` ruby
|
40
|
+
require 'jpdfunite'
|
41
|
+
file_one = Jpdfunite::PdfFile.new("lab7markup.pdf")
|
42
|
+
file_two = Jpdfunite::PdfFile.new("macorm.pdf")
|
43
|
+
file_three = Jpdfunite::PdfFile.new("discrete_math_textbook.pdf")
|
44
|
+
sec_one = Jpdfunite::Section.new("Section One")
|
45
|
+
sec_two = Jpdfunite::Section.new("Section Two")
|
46
|
+
document = Jpdfunite::Outline.new("Combined Files")
|
47
|
+
sec_one.add_mark(file_one)
|
48
|
+
sec_one.add_mark(file_two)
|
49
|
+
sec_two.add_mark(file_three)
|
50
|
+
document.add_mark(sec_one)
|
51
|
+
document.add_mark(sec_two)
|
52
|
+
outfile = Jpdfunite::combine(document)
|
53
|
+
Jpdfunite::outline(outfile, document)
|
54
|
+
```
|
36
55
|
|
37
56
|
## Contributing
|
38
57
|
|
data/jpdfunite.gemspec
CHANGED
data/lib/jpdfunite/version.rb
CHANGED
data/lib/jpdfunite.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "jpdfunite/version"
|
2
|
+
require "shellwords"
|
2
3
|
|
3
4
|
module Jpdfunite
|
4
5
|
|
@@ -7,7 +8,7 @@ module Jpdfunite
|
|
7
8
|
def combine(pdf_outline)
|
8
9
|
sans_outline = Tempfile.new("pdfgs")
|
9
10
|
sans_outline.close
|
10
|
-
%x[pdfunite #{pdf_outline.path} #{sans_outline.path}]
|
11
|
+
%x[pdfunite #{pdf_outline.path} #{sans_outline.path.shellescape}]
|
11
12
|
sans_outline
|
12
13
|
end
|
13
14
|
|
@@ -17,7 +18,7 @@ module Jpdfunite
|
|
17
18
|
pdfmarks.close
|
18
19
|
output = Tempfile.new(pdf_outline.title)
|
19
20
|
output.close
|
20
|
-
%x[jpdfbookmarks -f -a #{pdfmarks.path} #{sans_outline.path} -o #{output.path}]
|
21
|
+
%x[jpdfbookmarks -f -a #{pdfmarks.path} #{sans_outline.path} -o #{output.path.shellescape}]
|
21
22
|
output
|
22
23
|
end
|
23
24
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpdfunite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Piro-Rael
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shellwords
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Requires Java and poppler-utils
|
42
56
|
email:
|
43
57
|
- fdisk@fdisk.co
|