pdfinfo 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5a425d0b0736d042ad6cb90cd730ec12b1086cc
4
- data.tar.gz: f50db651591c946a6788ccdbb12ff3d9093ff789
3
+ metadata.gz: 4aaac914cb686f9cdd99edfbc378b8fbb4f91ef1
4
+ data.tar.gz: 404f4ebdb111f48bd5b538b03f1cc08a870d1dde
5
5
  SHA512:
6
- metadata.gz: e4b84b0d845a22db0e09d7651d6a62bd1af84108baa533af16d48975bfdba3ae28f3db9430acfb34e8a5c32aa894593910af66e93f994ad89f32aa69ae5a9d01
7
- data.tar.gz: 17b53e239955de60c1c75a531b3dbfe603c1e92d356f425aa0cb94c2f01a151943876034528d4b9ed2b3917d1163dc3cc10198ad171379df4b6bfe8dbd5642a5
6
+ metadata.gz: 0c4b285a441417f340030ed932a18aabc294b3784c0d358165dcff2d220b46663b98a503c8c8cfa5b1a467edef02e1882cf8db8acd0a5c379fd9e3ffca5acf40
7
+ data.tar.gz: 10956090e1a0ca786a85470fe43928bac9a83bad46cb8d1dc61c88e78c90c29be9fee3248b376d727779eec160d2991ba3acf7b5100bd6760cf142f536de9495
data/README.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # Pdfinfo
2
2
 
3
- TODO: Write a gem description
3
+ Simple ruby wrapper around the pdfinfo command
4
4
 
5
+ ## Depdendecies
6
+
7
+ usage of this gem assumes that you have xpdf installed. The fastest way to install xpdf:
8
+
9
+ $ brew install xpdf
10
+
5
11
  ## Installation
6
12
 
7
13
  Add this line to your application's Gemfile:
@@ -18,7 +24,28 @@ Or install it yourself as:
18
24
 
19
25
  ## Usage
20
26
 
21
- TODO: Write usage instructions here
27
+
28
+ ```ruby
29
+ pdfinfo = Pdfinfo.new("path/to/file.pdf")
30
+
31
+ pdfinfo.creator #=> "Creator Name" # or nil
32
+ pdfinfo.producer #=> "Producer Name" # or nil
33
+ pdfinfo.form #=> "none"
34
+ pdfinfo.page_count #=> 3
35
+ pdfinfo.width #=> 612
36
+ pdfinfo.height #=> 792
37
+ pdfinfo.size #=> 1521 # file size in bytes
38
+ pdfinfo.pdf_version #=> "1.3"
39
+ pdfinfo.encrypted? #=> false # or true
40
+ pdfinfo.tagged? #=> false # or true
41
+ ```
42
+
43
+ You can directly set the location of the executable if its not located in your environment $PATH or you just want to point to a different location.
44
+
45
+ ```ruby
46
+ Pdfinfo.pdfinfo_command = '/another/bin/path/pdfinfo'
47
+ Pdfinfo.pdfinfo_command #=> '/another/bin/path/pdfinfo'
48
+ ```
22
49
 
23
50
  ## Contributing
24
51
 
data/lib/pdfinfo.rb CHANGED
@@ -14,7 +14,7 @@ class Pdfinfo
14
14
  :pdf_version
15
15
 
16
16
  def self.exec(file_path)
17
- stdout, stderr, status = Open3.capture2e("pdfinfo #{file_path}")
17
+ stdout, stderr, status = Open3.capture2e("#{pdfinfo_command} #{file_path}")
18
18
  stdout.chomp
19
19
  end
20
20
 
@@ -27,7 +27,7 @@ class Pdfinfo
27
27
  end
28
28
 
29
29
  def initialize(source_path)
30
- info_hash = parse_shell_response(exec(source_path))
30
+ info_hash = parse_shell_response(Pdfinfo.exec(source_path))
31
31
 
32
32
  @creator = info_hash['Creator']
33
33
  @producer = info_hash['Producer']
@@ -50,10 +50,6 @@ class Pdfinfo
50
50
 
51
51
  private
52
52
 
53
- def exec(file_path)
54
- self.class.exec(file_path)
55
- end
56
-
57
53
  def parse_shell_response(response_str)
58
54
  Hash[response_str.split(/\n/).map {|kv| kv.split(/:\s+/) }]
59
55
  end
@@ -1,3 +1,3 @@
1
1
  class Pdfinfo
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfinfo
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
  - Ryan Venegas