class Plaintext::PptxHandler
Constants
- CONTENT_TYPES
Public Class Methods
new()
click to toggle source
Calls superclass method
Plaintext::OfficeDocumentHandler::new
# File lib/plaintext/file_handler/zipped_xml_handler/office_document_handler/pptx_handler.rb, line 11 def initialize super @content_types = CONTENT_TYPES @namespace_uri = 'http://schemas.openxmlformats.org/drawingml/2006/main' end
Public Instance Methods
text(file, options = {})
click to toggle source
# File lib/plaintext/file_handler/zipped_xml_handler/office_document_handler/pptx_handler.rb, line 17 def text(file, options = {}) max_size = options[:max_size] slides = [] result = ''.dup Zip::File.open(file) do |zip_file| zip_file.each do |entry| if entry.name =~ /slide(\d+)\.xml/ slides << [$1, entry] end end slides.sort!{|a, b| a.first <=> b.first} slides.each do |id, entry| result << xml_to_text(entry.get_input_stream, max_size) break if max_size and result.length >= max_size end end return result end