Sha256: 3397c44f799d5949c87f9dc75d49d53bc6e424e357b291164e92bc03d4f4997e

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

# coding: utf-8

module PDF
  class Reader

    # mixin for common methods in Page and FormXobjects
    #
    module ResourceMethods
      # Returns a Hash of color spaces that are available to this page
      #
      def color_spaces
        @objects.deref!(resources[:ColorSpace]) || {}
      end

      # Returns a Hash of fonts that are available to this page
      #
      def fonts
        @objects.deref!(resources[:Font]) || {}
      end

      # Returns a Hash of external graphic states that are available to this
      # page
      #
      def graphic_states
        @objects.deref!(resources[:ExtGState]) || {}
      end

      # Returns a Hash of patterns that are available to this page
      #
      def patterns
        @objects.deref!(resources[:Pattern]) || {}
      end

      # Returns an Array of procedure sets that are available to this page
      #
      def procedure_sets
        @objects.deref!(resources[:ProcSet]) || []
      end

      # Returns a Hash of properties sets that are available to this page
      #
      def properties
        @objects.deref!(resources[:Properties]) || {}
      end

      # Returns a Hash of shadings that are available to this page
      #
      def shadings
        @objects.deref!(resources[:Shading]) || {}
      end

      # Returns a Hash of XObjects that are available to this page
      #
      def xobjects
        @objects.deref!(resources[:XObject]) || {}
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pdf-reader-1.0.0 lib/pdf/reader/resource_methods.rb
pdf-reader-1.0.0.rc1 lib/pdf/reader/resource_methods.rb