class Rabbit::Parser::PDF

Public Class Methods

format_name() click to toggle source
# File lib/rabbit/parser/pdf.rb, line 29
def format_name
  "PDF"
end
match?(source) click to toggle source
# File lib/rabbit/parser/pdf.rb, line 33
def match?(source)
  extension = source.extension
  if extension.nil?
    source.read.start_with?("%PDF-1.")
  else
    /\Apdf\z/i =~ extension
  end
end

Public Instance Methods

parse() click to toggle source
# File lib/rabbit/parser/pdf.rb, line 44
def parse
  doc = Poppler::Document.new(:data => @source.read)
  doc.each_with_index do |page, i|
    if i.zero?
      @canvas << PopplerTitleSlide.new(page, doc)
    else
      @canvas << PopplerSlide.new(page)
    end
  end
end