class HexaPDF::Document::Images

Included Modules

This class provides methods for managing the images embedded in a PDF file. It is available through the Document#images method.

Images themselves are represented by the HexaPDF::Type::Image class.Since an image can be used as a mask for another image, not all image objects found in a PDF are really used as images. Such cases are all handled by this class automatically.

Public Class Methods


Creates a new Images object for the given PDF document.

Public Instance Methods

add(file) → image
add(io) → image

Adds the image from the given file or IO to the PDF document and returns the image object.

If the image has been added to the PDF before (i.e. if there is an image object with the same path name), the already existing image object is returned.

each {|image| block } → images
each → Enumerator

Iterates over all images in the PDF document.

Note that only real images are yielded which means, for example, that images used as soft mask are not.