jpdfunite 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9de1819c7e0abac97855730b16183b336c2a5f2d
4
- data.tar.gz: 7770f2563a9da0839221bb3c1faa0e9f4320f275
3
+ metadata.gz: 7c2057d6b3b7b2c81a41fe5e80af09472d320e5b
4
+ data.tar.gz: f5ed1ebc10eb7ce08798051bcba6a6504e12e24a
5
5
  SHA512:
6
- metadata.gz: a2f10da613a803ccb770c41c138354252f642a00068be375063ab63b08ce13db4ddb73c47246c081698ace63c2306790e3f2ce3ddd8c9ae21e0f1fd5b488c539
7
- data.tar.gz: 2b77f2f7767c0cab94081ed4af6b51fd1f30f8c9e52922e11ff6ef626331a4381156cc9dff8547d6202331b88abb4221e1344058f13342cd2a8c8fb2b76151db
6
+ metadata.gz: bbd9f64747deb92f37c2a687957cfac702258138b3dfe9b36be8f8c72ed89f479a2e51ab0e84a261ca531cf3e7810814a2ab553a39246137990dffc3385fe4d9
7
+ data.tar.gz: 7a6f2bb311e882b443173e54395d673306f1189a2a4edc183008f69fb05839f1d5aaf42bb24d036ef188caa994b5062b3dcae5d266e1033a9d307da4f66eb7cd
data/.gitignore CHANGED
@@ -13,4 +13,5 @@
13
13
  *.a
14
14
  *.env
15
15
  *.swp
16
+ *.gem
16
17
  mkmf.log
data/README.md CHANGED
@@ -32,7 +32,26 @@ bookmarks to PDF (GPLv3)
32
32
 
33
33
  ## Usage
34
34
 
35
- TODO: Write usage instructions here
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
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "shellwords"
23
24
  end
@@ -1,3 +1,3 @@
1
1
  module Jpdfunite
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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