Class: Pdf::ImageExtractor::Processor

Inherits:
HexaPDF::Content::Processor
  • Object
show all
Defined in:
app/services/pdf/image_extractor.rb

Overview

HexaPDF content processor that records image placements. Image XObjects
are intercepted; Form XObjects fall through to the default implementation,
which recurses with the form's matrix premultiplied into the CTM.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resources, page_number:, workdir:) ⇒ Processor

Returns a new instance of Processor.



40
41
42
43
44
45
46
# File 'app/services/pdf/image_extractor.rb', line 40

def initialize(resources, page_number:, workdir:)
  super(resources)
  @page_number = page_number
  @workdir     = workdir
  @placements  = []
  @counter     = 0
end

Instance Attribute Details

#placementsObject (readonly)

Returns the value of attribute placements.



38
39
40
# File 'app/services/pdf/image_extractor.rb', line 38

def placements
  @placements
end

Instance Method Details

#paint_xobject(name) ⇒ Object (protected)

Default implementation for the 'Do' operator — invoked for every
painted XObject. Images are recorded; forms recurse via super.



52
53
54
55
56
57
58
59
# File 'app/services/pdf/image_extractor.rb', line 52

def paint_xobject(name)
  xobject = resources.xobject(name)
  if xobject && xobject[:Subtype] == :Image
    record(xobject)
  else
    super
  end
end