Class: IiifPrint::SplitPdfs::PdfImageExtractionService

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb

Overview

Uses poppler 0.19+ pdfimages command to extract image

listing metadata from PDF files.

For dpi extraction, falls back to calculating using MiniMagick,

if neccessary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PdfImageExtractionService

Returns a new instance of PdfImageExtractionService.



11
12
13
14
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 11

def initialize(path)
  @path = path
  process(command: format('pdfimages -list %<path>s 2>/dev/null', path: path))
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



16
17
18
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 16

def height
  @height
end

#page_countObject (readonly)

Returns the value of attribute page_count.



16
17
18
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 16

def page_count
  @page_count
end

#pathObject (readonly)

Returns the value of attribute path.



16
17
18
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 16

def path
  @path
end

#pixels_per_inchObject (readonly) Also known as: ppi

Returns the value of attribute pixels_per_inch.



16
17
18
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 16

def pixels_per_inch
  @pixels_per_inch
end

#widthObject (readonly)

Returns the value of attribute width.



16
17
18
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 16

def width
  @width
end

Instance Method Details

#colorArray<String, Integer, Integer>

Returns:

  • (Array<String, Integer, Integer>)


20
21
22
# File 'lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb', line 20

def color
  [@color_description, @channels, @bits]
end