PdfImageOccurrence Class
An image painted by the content of a page (PdfPage.GetImages): an image XObject painted by Do, directly or by a form, or an inline image (ISO 32000-2, 8.9). An image XObject painted several times is an occurrence each time, with the same PdfImageOccurrence.Reference.
public sealed class PdfImageOccurrenceProperties
| Name | Description |
|---|---|
| BitsPerComponent | Gets the number of bits of each component of a sample, or 0 when the filter of the image gives it (JPXDecode). |
| Bounds | Gets the bounding box of the image on the page, in default user space: the unit square transformed by PdfImageOccurrence.Matrix. |
| ColorSpace | Gets the color space of the image (/ColorSpace), resolved in the resources when it is a name, or null (an image mask, a JPXDecode image). |
| Dictionary | Gets the image dictionary: the dictionary of the stream, or the dictionary of an inline image with its abbreviated keys expanded (/W is /Width...). Its color space can be the name of a resource. |
| EncodedData | Gets the data of the image, encoded with its filters (PdfImageOccurrence.Filters). |
| Filters | Gets the filters of the data, such as DCTDecode for a JPEG image. |
| Height | Gets the height of the image, in samples. |
| IsImageMask | Gets a value indicating whether the image is a stencil mask, painted with the fill color (8.9.6.2). |
| IsInline | Gets a value indicating whether the image is an inline image (BI ... ID ... EI). |
| Matrix | Gets the matrix from the unit square of the image to the default user space of the page: the transformation matrix when the image is painted (8.9.4). |
| Name | Gets the name of the image XObject in the resources it was painted from, or null for an inline image. |
| Page | Gets the page. |
| Reference | Gets the reference to the image XObject, or null for an inline image or a direct stream. |
| SoftMask | Gets the soft mask of the image (/SMask, 11.6.5.3), or null. |
| Width | Gets the width of the image, in samples. |
BitsPerComponent
PdfImageOccurrence.csBounds
PdfImageOccurrence.csGets the bounding box of the image on the page, in default user space: the unit square transformed by PdfImageOccurrence.Matrix.
public PdfRectangle Bounds { get; }Property value
ColorSpace
PdfImageOccurrence.csGets the color space of the image (/ColorSpace), resolved in the resources when it is a name, or null (an image mask, a JPXDecode image).
public PdfObject? ColorSpace { get; }Property value
Dictionary
PdfImageOccurrence.csGets the image dictionary: the dictionary of the stream, or the dictionary of an inline image with its abbreviated keys expanded (/W is /Width...). Its color space can be the name of a resource.
public PdfDictionary Dictionary { get; }Property value
EncodedData
PdfImageOccurrence.csGets the data of the image, encoded with its filters (PdfImageOccurrence.Filters).
public ReadOnlyMemory<byte> EncodedData { get; }Property value
Filters
PdfImageOccurrence.csGets the filters of the data, such as DCTDecode for a JPEG image.
public IReadOnlyList<PdfName> Filters { get; }Property value
Height
PdfImageOccurrence.csIsImageMask
PdfImageOccurrence.csIsInline
PdfImageOccurrence.csMatrix
PdfImageOccurrence.csReference
PdfImageOccurrence.csGets the reference to the image XObject, or null for an inline image or a direct stream.
public PdfReference? Reference { get; }Property value
SoftMask
PdfImageOccurrence.csGets the soft mask of the image (/SMask, 11.6.5.3), or null.
public PdfStream? SoftMask { get; }Property value
Methods
| Name | Description |
|---|---|
| Decode() | Decodes the image to RGBA pixels: its color space converted to sRGB, its decode array, its mask or soft mask applied as the alpha channel, within the limits of the read options of the document. A stencil mask is black where it paints. |
Decode()
PdfImageOccurrence.csDecodes the image to RGBA pixels: its color space converted to sRGB, its decode array, its mask or soft mask applied as the alpha channel, within the limits of the read options of the document. A stencil mask is black where it paints.
Returns
Image<Rgba32>? The image, which the caller disposes, or null when the image has no pixels.
Exceptions
InvalidPdfContentException- The data of the image cannot be decoded.
UnsupportedPdfFeatureException- The image uses a feature the library does not support.
PdfResourceLimitException- The image exceeds a limit of the read options.