Skip to content

# PDFVisualImage

Namespace: O2S.Components.PDF4NET.Content

Defines an image that displayed on a PDF page.

    public class PDFVisualImage

Inheritance Object → PDFVisualImage

## Constructors

## Properties

### BitsPerComponent

Gets the bits per component.

    public int BitsPerComponent { get; internal set; }

Property Value

Int32
The number of bits used to represent a color component in the image's colorspace.

### ChromaKeyMask

Gets the image chroma key mask.

    public Int32[] ChromaKeyMask { get; internal set; }

Property Value

Int32[]
An array of color components specifying the range of colors that are considered transparent.

### ColorSpace

Gets the image colorspace.

    public PDFColorSpace ColorSpace { get; internal set; }

Property Value

PDFColorSpace
The colorspace the image data is represent in.

### CosStream

Gets the inernal COS stream that represents the image object.

    public PDFCosStream CosStream { get; internal set; }

Property Value

PDFCosStream
A PDFCosStream representing the raw image.

### DisplayHeight

Gets the height of the displayed image on the page.

    public double DisplayHeight { get; internal set; }

Property Value

Double
The height, in points, of the displayed image on the page.

### DisplayWidth

Gets the width of the displayed image on the page.

    public double DisplayWidth { get; internal set; }

Property Value

Double
The width, in points, of the displayed image on the page.

### DpiX

Gets the image's horizontal resolution.

    public double DpiX { get; internal set; }

Property Value

Double
The horizontal resolution of the displayed image.

### DpiY

Gets the image's vertical resolution.

    public double DpiY { get; internal set; }

Property Value

Double
The vertical resolution of the displayed image.

### Height

Gets the image height.

    public int Height { get; internal set; }

Property Value

Int32
The height of the image in pixels.

### ImageCorners

Gets the coordinates of the image corners.

    public PDFPoint[] ImageCorners { get; internal set; }

Property Value

PDFPoint[]
The coordinates on the page of the image's corners.

Remarks

The order of the corners in the array is the following: lower left, lower right, upper right, upper left.

### ImageFormat

Gets the format of the embedded image.

    public PDFVisualImageFormat ImageFormat { get; internal set; }

Property Value

PDFVisualImageFormat
The format the image is embedded in the PDF file.

### ImageID

Gets the image ID.

    public string ImageID { get; internal set; }

Property Value

String
The ID of the image in the page's resources dictionary.

### IsImageMask

Gets a value indicating whether this image is actually a mask.

    public bool IsImageMask { get; internal set; }

Property Value

Boolean
True if the image represents a mask.

### Mask

Gets the image mask.

    public PDFVisualImage Mask { get; internal set; }

Property Value

PDFVisualImage
The mask associated with this image.

### Palette

Gets the image palette.

    public Byte[] Palette { get; internal set; }

Property Value

Byte[]
An array of bytes representing RGB tuples that define the image palette or null if the image does not use a palette.

### Width

Gets the image width.

    public int Width { get; internal set; }

Property Value

Int32
The width of the image in pixels.

## Methods

### Save(Stream, PDFVisualImageSaveFormat)

Saves the image to the stream.

    public void Save(Stream stream, PDFVisualImageSaveFormat imageSaveFormat)

Parameters

`stream` Stream
Destination stream where the image will be saved.

`imageSaveFormat` PDFVisualImageSaveFormat
Format used for saving the image.

Exceptions

InvalidOperationException
Thrown when the Save method is called on an image that has been extracted without its data, PDFContentExtractor.ExtractImages method has been called using 'false' as its parameter.
- or -
when the image format is JPEG2000 and the imageSaveFormat is not PDFVisualImageSaveFormat.Native.