Class: Rabbit::Parser::PDF
Constant Summary
ModuleLoader::LOADERS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
extend_object, #find_loader, #loaders, #push_loader, #unshift_loader
Class Method Details
13
14
15
|
# File 'lib/rabbit/parser/pdf.rb', line 13
def format_name
"PDF"
end
|
.match?(source) ⇒ Boolean
17
18
19
20
21
22
23
24
|
# File 'lib/rabbit/parser/pdf.rb', line 17
def match?(source)
extension = source.extension
if extension.nil?
source.read.start_with?("%PDF-1.")
else
/\Apdf\z/i =~ extension
end
end
|
Instance Method Details
#parse ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/rabbit/parser/pdf.rb', line 28
def parse
doc = Poppler::Document.new(@source.read)
title_page, *rest = doc.to_a
@canvas << PopplerTitleSlide.new(title_page, doc)
rest.each do |page|
@canvas << PopplerSlide.new(page)
end
end
|