Class: ComicBook::PDF
- Inherits:
-
Adapter
show all
- Defined in:
- lib/comic_book/pdf.rb,
lib/comic_book/pdf/extractor.rb
Defined Under Namespace
Classes: Extractor
Instance Method Summary
collapse
Methods inherited from Adapter
#initialize
Instance Method Details
#archive(_options = {}) ⇒ Object
10
11
12
|
# File 'lib/comic_book/pdf.rb', line 10
def archive _options = {}
raise Error, 'PDF archiving not supported (use extract to convert PDF pages to images)'
end
|
14
15
16
17
|
# File 'lib/comic_book/pdf.rb', line 14
def options = {}
require_vips!
Extractor.new(path). options
end
|
#info ⇒ Object
6
7
8
|
# File 'lib/comic_book/pdf.rb', line 6
def info
nil
end
|
#pages ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/comic_book/pdf.rb', line 19
def pages
require_vips!
image = Vips::Image.new_from_file path
count = image.get 'n-pages'
(1..count).map do |page_number|
name = format('page_%03d.jpg', page_number)
ComicBook::Page.new name, name
end
rescue StandardError => e
raise unless e.class.name == 'Vips::Error'
[]
end
|