pdfs2pdf 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOGS.md +10 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +0 -4
- data/bin/pdfs2pdf +1 -4
- data/config/initializers/pdfs2pdf.rb +1 -0
- data/lib/pdfs2pdf/cli.rb +4 -11
- data/lib/pdfs2pdf/pdfs2pdf.rb +62 -0
- data/lib/pdfs2pdf/version.rb +1 -1
- data/lib/pdfs2pdf.rb +1 -1
- data/pdfs2pdf.gemspec +14 -6
- data/rubocop-todo.yml +10 -63
- data/test/lib/pdfs2pdf/test_pdfs2pdf.rb +2 -2
- metadata +6 -15
- data/.rspec +0 -2
- data/.ruby-version +0 -1
- data/Guardfile +0 -13
- data/demo1.png +0 -0
- data/demo2.png +0 -0
- data/demo3.png +0 -0
- data/demo4.png +0 -0
- data/final_output.png +0 -0
- data/lib/pdfs2pdf/utils.rb +0 -64
- data/pdfmarks +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40d847513b193a6418a3db08e3f1dfdd3f471bc2
|
4
|
+
data.tar.gz: f0be5cded86673ad6e2f9e58cdf0ed30a825299d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50daef0b58123a77884540813099de323c2c708260af2f68b9f4d371cff795b764c8b85a7e374c0126bddaec69c2ffe9f333119c927f8dc1ff114cfaaaca07b8
|
7
|
+
data.tar.gz: fa12e065db643aaaccf18a616c8a8ce4712ae6347a535f502c70bf0b0706b83f71ddba5b2bb3a37bd17f60c7148fca1f6004cec4da922b51393b249b3c0c1650
|
data/CHANGELOGS.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
### Changelogs
|
2
2
|
|
3
|
+
#### 0.0.7
|
4
|
+
|
5
|
+
- Simplify the api by removing some of the options
|
6
|
+
* --inc-words
|
7
|
+
* --exc-words
|
8
|
+
* --ignorecase
|
9
|
+
- Rename 'utils.rb' to 'pdfs2pdf.rb'
|
10
|
+
- Update gemspec
|
11
|
+
- Misc cleanup
|
12
|
+
|
3
13
|
#### 0.0.6
|
4
14
|
|
5
15
|
- Allow options for wkhtmltopdf to be more customizable
|
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -102,10 +102,6 @@ Usage:
|
|
102
102
|
Options:
|
103
103
|
-b, [--base-dir=BASE_DIR] # Base directory
|
104
104
|
# Default: . (current directory)
|
105
|
-
-n, [--inc-words=one two three] # List of words to be included in the result
|
106
|
-
-x, [--exc-words=one two three] # List of words to be excluded from the result
|
107
|
-
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
108
|
-
# Default: true
|
109
105
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
110
106
|
# Default: true
|
111
107
|
-v, [--version], [--no-version] # Display version information
|
data/bin/pdfs2pdf
CHANGED
@@ -5,6 +5,7 @@ module Pdfs2Pdf
|
|
5
5
|
# See: ./lib/pdfs2pdf/configuration.rb for available options
|
6
6
|
def update_config
|
7
7
|
Pdfs2Pdf.configure do |config|
|
8
|
+
# Note: add your custom config here
|
8
9
|
# config.wkhtmltopdf = '/usr/bin/wkhtmltopdf'
|
9
10
|
# config.default_options = {
|
10
11
|
# paper_size: 'Letter',
|
data/lib/pdfs2pdf/cli.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require 'thor'
|
3
3
|
require 'tmpdir'
|
4
4
|
require 'fileutils'
|
5
|
+
require_relative './pdfs2pdf'
|
5
6
|
require_relative '../pdfs2pdf'
|
6
|
-
require_relative './utils'
|
7
7
|
module Pdfs2Pdf
|
8
8
|
include AgileUtils::Options
|
9
9
|
include CodeLister
|
@@ -11,9 +11,6 @@ module Pdfs2Pdf
|
|
11
11
|
class CLI < Thor
|
12
12
|
desc 'merge', 'Combine multiple pdfs into one file with bookmarks'
|
13
13
|
method_option *AgileUtils::Options::BASE_DIR
|
14
|
-
method_option *AgileUtils::Options::INC_WORDS
|
15
|
-
method_option *AgileUtils::Options::EXC_WORDS
|
16
|
-
method_option *AgileUtils::Options::IGNORE_CASE
|
17
14
|
method_option *AgileUtils::Options::RECURSIVE
|
18
15
|
method_option *AgileUtils::Options::VERSION
|
19
16
|
|
@@ -34,10 +31,6 @@ Usage:
|
|
34
31
|
Options:
|
35
32
|
-b, [--base-dir=BASE_DIR] # Base directory
|
36
33
|
# Default: . (current directory)
|
37
|
-
-n, [--inc-words=one two three] # List of words to be included in the result
|
38
|
-
-x, [--exc-words=one two three] # List of words to be excluded from the result
|
39
|
-
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
40
|
-
# Default: true
|
41
34
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
42
35
|
# Default: true
|
43
36
|
-v, [--version], [--no-version] # Display version information
|
@@ -52,17 +45,17 @@ Combine multiple pdfs into one file with bookmarks
|
|
52
45
|
|
53
46
|
def create_pdfmarks(page_list, base_dir)
|
54
47
|
elapsed = AgileUtils::FileUtil.time do
|
55
|
-
Pdfs2Pdf
|
48
|
+
Pdfs2Pdf.create_pdfmarks(page_list, 'pdfmarks', base_dir)
|
56
49
|
end
|
57
50
|
puts "Create pdfmarks took #{elapsed} ms"
|
58
51
|
end
|
59
52
|
|
60
53
|
def merge_pdfs(pdf_files)
|
61
54
|
elapsed = AgileUtils::FileUtil.time do
|
62
|
-
|
55
|
+
Pdfs2Pdf.merge_pdfs(pdf_files, 'pdfmarks', 'pdfs2pdf_output.pdf')
|
63
56
|
end
|
64
57
|
puts "Combine pdf files took #{elapsed} ms"
|
65
|
-
puts "Your
|
58
|
+
puts "Your combined pdf is available at #{File.absolute_path('pdfs2pdf_output.pdf')}"
|
66
59
|
end
|
67
60
|
end
|
68
61
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'open3'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'pdf-reader'
|
5
|
+
require_relative '../pdfs2pdf'
|
6
|
+
require_relative './configuration'
|
7
|
+
module Pdfs2Pdf
|
8
|
+
class << self
|
9
|
+
# Create the 'pdfmarks' file for use with 'gs' utility
|
10
|
+
#
|
11
|
+
# @param [Array<String>] pdf_files the input file list (pdf)
|
12
|
+
# @param [String] output_file the output filename default to 'pdfmarks'
|
13
|
+
# @param [String] base_dir the base directory (TODO: review this code!)
|
14
|
+
def create_pdfmarks(pdf_files, pdfmarks_file = 'pdfmarks', base_dir = Dir.pwd)
|
15
|
+
File.open(pdfmarks_file, 'w') do |out_file|
|
16
|
+
out_file.write(Pdfs2Pdf.configuration.pdfmarks_meta)
|
17
|
+
current_page = 1
|
18
|
+
pdf_files.each do |pdf_file|
|
19
|
+
filename = if base_dir
|
20
|
+
# remove the base_directory from the full path
|
21
|
+
pdf_file.gsub(base_dir, File.basename(pdf_file))
|
22
|
+
else
|
23
|
+
pdf_file
|
24
|
+
end
|
25
|
+
out_file.write "[ /Page #{current_page} /Title (#{filename}) /OUT pdfmark\n"
|
26
|
+
current_page += page_count(pdf_file)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Merge/combine list of pdf files using Ghostscript's `gs` command
|
32
|
+
#
|
33
|
+
# @param [Array<String>] list input file list
|
34
|
+
# @param [String] pdfmarks the pdfmarks file default to 'pdfmarks'
|
35
|
+
# @param [String] output_file the output pdf file
|
36
|
+
def merge_pdfs(list, pdfmarks = 'pdfmarks', output_file = 'output.pdf')
|
37
|
+
paper_size = Pdfs2Pdf.configuration.default_options[:paper_size]
|
38
|
+
_stdin, _stderr, status = Open3.capture3(
|
39
|
+
'gs',
|
40
|
+
'-q',
|
41
|
+
'-dNOPAUSE',
|
42
|
+
'-dBATCH',
|
43
|
+
'-sDEVICE=pdfwrite',
|
44
|
+
"-sPAPERSIZE=#{paper_size}",
|
45
|
+
"-sOutputFile=#{output_file}",
|
46
|
+
*list,
|
47
|
+
pdfmarks)
|
48
|
+
fail 'Problem in merge_pdfs' unless status.success?
|
49
|
+
end
|
50
|
+
|
51
|
+
# Extract pdf page count using pdf-reader
|
52
|
+
#
|
53
|
+
# @return [Fixnum] the page count of the given pdf file
|
54
|
+
def page_count(pdf_file)
|
55
|
+
File.open(pdf_file, 'rb') do |io|
|
56
|
+
reader = PDF::Reader.new(io)
|
57
|
+
return reader.page_count
|
58
|
+
end
|
59
|
+
fail "Problem getting the page count for #{pdf_file}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/pdfs2pdf/version.rb
CHANGED
data/lib/pdfs2pdf.rb
CHANGED
data/pdfs2pdf.gemspec
CHANGED
@@ -8,17 +8,25 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Pdfs2Pdf::VERSION
|
9
9
|
spec.authors = ['Burin Choomnuan']
|
10
10
|
spec.email = ['agilecreativity@gmail.com']
|
11
|
-
spec.summary = %q
|
12
|
-
spec.description = %q
|
11
|
+
spec.summary = %q(Combine multiple pdfs into one pdf with proper bookmarks for easy navigation)
|
12
|
+
spec.description = %q(Combine multiple pdfs into a single file with bookmarks for easy navigation)
|
13
13
|
spec.homepage = 'https://github.com/agilecreativity/pdfs2pdf'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.files =
|
15
|
+
spec.files = Dir.glob('{bin,lib,config}/**/*') + %w(Gemfile
|
16
|
+
Rakefile
|
17
|
+
pdfs2pdf.gemspec
|
18
|
+
README.md
|
19
|
+
CHANGELOGS.md
|
20
|
+
LICENSE
|
21
|
+
.rubocop.yml
|
22
|
+
.gitignore
|
23
|
+
rubocop-todo.yml)
|
16
24
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files =
|
18
|
-
spec.require_paths = [
|
25
|
+
spec.test_files = Dir.glob('{test}/**/*')
|
26
|
+
spec.require_paths = ['lib']
|
19
27
|
spec.add_runtime_dependency 'thor'
|
20
28
|
spec.add_runtime_dependency 'agile_utils', '~> 0.0.9'
|
21
|
-
spec.add_runtime_dependency 'code_lister', '~> 0.0.
|
29
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.0.9'
|
22
30
|
spec.add_runtime_dependency 'pdf-reader', '~> 1.3.3'
|
23
31
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
24
32
|
spec.add_development_dependency 'gem-ctags', '~> 1.0'
|
data/rubocop-todo.yml
CHANGED
@@ -1,84 +1,31 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2014-
|
2
|
+
# on 2014-05-11 23:16:45 +1000 using RuboCop version 0.21.0.
|
3
3
|
# The point is for the user to remove these configuration records
|
4
4
|
# one by one as the offenses are removed from the code base.
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
6
6
|
# versions of RuboCop, may require this file to be generated again.
|
7
7
|
|
8
|
-
# Offense count:
|
8
|
+
# Offense count: 3
|
9
9
|
AmbiguousOperator:
|
10
10
|
Enabled: false
|
11
11
|
|
12
|
-
# Offense count:
|
13
|
-
# Cop supports --auto-correct.
|
14
|
-
# Configuration parameters: PreferredMethods.
|
15
|
-
CollectionMethods:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
# Offense count: 1
|
19
|
-
CyclomaticComplexity:
|
20
|
-
Max: 7
|
21
|
-
|
22
|
-
# Offense count: 5
|
12
|
+
# Offense count: 7
|
23
13
|
Documentation:
|
24
14
|
Enabled: false
|
25
15
|
|
26
|
-
# Offense count:
|
27
|
-
# Cop supports --auto-correct.
|
28
|
-
EmptyLinesAroundBody:
|
29
|
-
Enabled: true
|
30
|
-
|
31
|
-
# Offense count: 1
|
32
|
-
# Cop supports --auto-correct.
|
33
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
34
|
-
HashSyntax:
|
35
|
-
Enabled: true
|
36
|
-
|
37
|
-
# Offense count: 4
|
38
|
-
# Cop supports --auto-correct.
|
39
|
-
LeadingCommentSpace:
|
40
|
-
Enabled: true
|
41
|
-
|
42
|
-
# Offense count: 18
|
16
|
+
# Offense count: 7
|
43
17
|
LineLength:
|
44
|
-
Max:
|
18
|
+
Max: 123
|
45
19
|
|
46
|
-
# Offense count:
|
20
|
+
# Offense count: 3
|
47
21
|
# Configuration parameters: CountComments.
|
48
22
|
MethodLength:
|
49
|
-
Max:
|
23
|
+
Max: 15
|
50
24
|
|
51
25
|
# Offense count: 1
|
52
|
-
|
53
|
-
|
54
|
-
Enabled: true
|
26
|
+
RegexpLiteral:
|
27
|
+
MaxSlashes: 0
|
55
28
|
|
56
29
|
# Offense count: 1
|
57
|
-
|
58
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
59
|
-
SpaceInsideBlockBraces:
|
60
|
-
Enabled: true
|
61
|
-
|
62
|
-
# Offense count: 1
|
63
|
-
# Cop supports --auto-correct.
|
64
|
-
SpecialGlobalVars:
|
65
|
-
Enabled: true
|
66
|
-
|
67
|
-
# Offense count: 16
|
68
|
-
# Cop supports --auto-correct.
|
69
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
70
|
-
StringLiterals:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
# Offense count: 1
|
74
|
-
UnreachableCode:
|
75
|
-
Enabled: true
|
76
|
-
|
77
|
-
# Offense count: 1
|
78
|
-
UselessAssignment:
|
30
|
+
UnusedBlockArgument:
|
79
31
|
Enabled: false
|
80
|
-
|
81
|
-
# Offense count: 1
|
82
|
-
# Cop supports --auto-correct.
|
83
|
-
WordArray:
|
84
|
-
MinSize: 2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
|
-
describe Pdfs2Pdf
|
2
|
+
describe Pdfs2Pdf do
|
3
3
|
context '#page_count' do
|
4
4
|
it 'returns result for valid command' do
|
5
5
|
input_file = 'test/fixtures/samples/demo1_xxx.rb.xhtml.pdf'
|
6
|
-
result = Pdfs2Pdf
|
6
|
+
result = Pdfs2Pdf.page_count(input_file)
|
7
7
|
result.must_equal 1
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfs2pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.9
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
54
|
+
version: 0.0.9
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pdf-reader
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,28 +201,19 @@ extensions: []
|
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
203
|
- ".gitignore"
|
204
|
-
- ".rspec"
|
205
204
|
- ".rubocop.yml"
|
206
|
-
- ".ruby-version"
|
207
205
|
- CHANGELOGS.md
|
208
206
|
- Gemfile
|
209
|
-
-
|
210
|
-
- LICENSE.txt
|
207
|
+
- LICENSE
|
211
208
|
- README.md
|
212
209
|
- Rakefile
|
213
210
|
- bin/pdfs2pdf
|
214
211
|
- config/initializers/pdfs2pdf.rb
|
215
|
-
- demo1.png
|
216
|
-
- demo2.png
|
217
|
-
- demo3.png
|
218
|
-
- demo4.png
|
219
|
-
- final_output.png
|
220
212
|
- lib/pdfs2pdf.rb
|
221
213
|
- lib/pdfs2pdf/cli.rb
|
222
214
|
- lib/pdfs2pdf/configuration.rb
|
223
|
-
- lib/pdfs2pdf/
|
215
|
+
- lib/pdfs2pdf/pdfs2pdf.rb
|
224
216
|
- lib/pdfs2pdf/version.rb
|
225
|
-
- pdfmarks
|
226
217
|
- pdfs2pdf.gemspec
|
227
218
|
- rubocop-todo.yml
|
228
219
|
- test/fixtures/samples/demo1_xxx.rb.xhtml.pdf
|
data/.rspec
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.1
|
data/Guardfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
guard 'minitest' do
|
4
|
-
# with Minitest::Unit
|
5
|
-
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
|
6
|
-
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
7
|
-
watch(%r|^test/test_helper\.rb|) { "test" }
|
8
|
-
|
9
|
-
# with Minitest::Spec
|
10
|
-
# watch(%r|^spec/(.*)_spec\.rb|)
|
11
|
-
# watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
-
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
13
|
-
end
|
data/demo1.png
DELETED
Binary file
|
data/demo2.png
DELETED
Binary file
|
data/demo3.png
DELETED
Binary file
|
data/demo4.png
DELETED
Binary file
|
data/final_output.png
DELETED
Binary file
|
data/lib/pdfs2pdf/utils.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'open3'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'pdf-reader'
|
5
|
-
require_relative '../pdfs2pdf'
|
6
|
-
require_relative './configuration'
|
7
|
-
module Pdfs2Pdf
|
8
|
-
class Utils
|
9
|
-
class << self
|
10
|
-
# Create the 'pdfmarks' file for use with 'gs' utility
|
11
|
-
#
|
12
|
-
# @param [Array<String>] pdf_files the input file list (pdf)
|
13
|
-
# @param [String] output_file the output filename default to 'pdfmarks'
|
14
|
-
# @param [String] base_dir the base directory (TODO: review this code!)
|
15
|
-
def create_pdfmarks(pdf_files, pdfmarks_file = 'pdfmarks', base_dir = Dir.pwd)
|
16
|
-
File.open(pdfmarks_file, 'w') do |out_file|
|
17
|
-
out_file.write(Pdfs2Pdf.configuration.pdfmarks_meta)
|
18
|
-
current_page = 1
|
19
|
-
pdf_files.each do |pdf_file|
|
20
|
-
filename = if base_dir
|
21
|
-
# remove the base_directory from the full path
|
22
|
-
pdf_file.gsub(base_dir, File.basename(pdf_file))
|
23
|
-
else
|
24
|
-
pdf_file
|
25
|
-
end
|
26
|
-
out_file.write "[ /Page #{current_page} /Title (#{filename}) /OUT pdfmark\n"
|
27
|
-
current_page += page_count(pdf_file)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Merge/combine list of pdf files using Ghostscript's `gs` command
|
33
|
-
#
|
34
|
-
# @param [Array<String>] list input file list
|
35
|
-
# @param [String] pdfmarks the pdfmarks file default to 'pdfmarks'
|
36
|
-
# @param [String] output_file the output pdf file
|
37
|
-
def merge_pdfs(list, pdfmarks = 'pdfmarks', output_file = 'output.pdf')
|
38
|
-
paper_size = Pdfs2Pdf.configuration.default_options[:paper_size]
|
39
|
-
_stdin, _stderr, status = Open3.capture3(
|
40
|
-
'gs',
|
41
|
-
'-q',
|
42
|
-
'-dNOPAUSE',
|
43
|
-
'-dBATCH',
|
44
|
-
'-sDEVICE=pdfwrite',
|
45
|
-
"-sPAPERSIZE=#{paper_size}",
|
46
|
-
"-sOutputFile=#{output_file}",
|
47
|
-
*list,
|
48
|
-
pdfmarks)
|
49
|
-
fail 'Problem in merge_pdfs' unless status.success?
|
50
|
-
end
|
51
|
-
|
52
|
-
# Extract pdf page count using pdf-reader
|
53
|
-
#
|
54
|
-
# @return [Fixnum] the page count of the given pdf file
|
55
|
-
def page_count(pdf_file)
|
56
|
-
File.open(pdf_file, 'rb') do |io|
|
57
|
-
reader = PDF::Reader.new(io)
|
58
|
-
return reader.page_count
|
59
|
-
end
|
60
|
-
fail "Problem getting the page count for #{pdf_file}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/pdfmarks
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
[ /Title (My Combined Pdf)
|
2
|
-
/Author (Burin Choomnuan)
|
3
|
-
/Keywords (fun, witty, interesting)
|
4
|
-
/DOCINFO pdfmark
|
5
|
-
[ /Page 1 /Title (demo1_xxx.rb.xhtml.pdf/demo1_xxx.rb.xhtml.pdf) /OUT pdfmark
|
6
|
-
[ /Page 2 /Title (demo2_xxx.rb.xhtml.pdf/demo2_xxx.rb.xhtml.pdf) /OUT pdfmark
|
7
|
-
[ /Page 3 /Title (demo3_xxx.rb.xhtml.pdf/sub_dir/demo3_xxx.rb.xhtml.pdf) /OUT pdfmark
|
8
|
-
[ /Page 4 /Title (demo4_xxx.rb.xhtml.pdf/sub_dir/demo4_xxx.rb.xhtml.pdf) /OUT pdfmark
|