PdfImage Object

Overview

PdfImage represents an image opened via PdfDocument's OpenImage or OpenImageBinary methods. Currently, AspPDF.NET supports BMP, GIF, JPEG, PNG and TIFF image formats. For more information on images, see Section 5.1 - PdfImage Object.

Member List

Properties


int BitsPerComponent (Read-only)
Returns the number of bits per color component for this image. This number can be 1, 2, 4, or 8 depending on the image format. The property returns 8 for all GIF, JPEG, and 24-bit BMP images.

string ColorSpace (Read-only)
Returns the color space name for this image. Possible values are "DeviceGray" for grayscale images, "DeviceCMYK" for CMYK images, and "DeviceRGB" for RGB images.

int ComponentsPerSample (Read-only)
Returns the number of color components per sample (a rough equivalent of a pixel). This property is 1 for monochrome bitmaps, 3 for RGB images and 4 for CMYK images.

string Format (Read-only)

Returns the image format. Possible values are "GIF", "BMP", "JPG", "PNG" and "TIF" for GIF, BMP, JPEG, PNG and TIFF images, respectively.

Note: PNG format is supported starting with version 1.6.0.2.


float Height (Read-only)
Returns the image height in pixels.

PdfTextItems Hyperlinks (Read-only)

Returns the collection of PdfRect objects representing the hyperlinks depicted on this image if this image object was generated by the PdfDocument.OpenUrl method with the Hyperlinks parameter set to true. If this image object was created via any method other than OpenUrl, this collection is empty.

This property was introduced in version 2.9. For more info, see Chapter 18 - IE-based HTML-to-PDF Conversion.


bool IsMask (Read/Write)
Marks an image as a mask. For more information about using images as masks, see Section 5.2.1 - Explicit Masking.

PdfImage NextImage (Read-only)

Returns the next image in the sequence generated by the PdfDocument.OpenUrl method, or null if this is the last image object in the sequence. If this image object was created via any method other than OpenUrl, this property returns null .

This property was introduced in version 2.9. For more info, see Chapter 16 - IE-based HTML-to-PDF Conversion.


float ResolutionX (Read-only)
Returns the resolution, in dots per inch (dpi), of the image along the X-axis. This property always returns 72 for GIF, PNG and BMP images.

float ResolutionY (Read-only)
Returns the resolution, in dots per inch (dpi), of the image along the Y-axis. This property always returns 72 for GIF, PNG and BMP images.

PdfParam TransparencyColor (Read-only)

If the underlying image is a transparent GIF, this property returns a PdfParam object filled with transparency color information. This property is currently obsolete.


bool TransparencyColorExists (Read-only)

Returns True if the underlying image is a transparent GIF, False otherwise. Should be used before the TransparencyColor property can be used to prevent an exception. This property is currently obsolete.


float Width (Read-only)
Returns the image width in pixels.

Methods


void ClearMask()
Clears a mask set by SetColorMask or SetImageMask methods.

void SetColorMask(object Param)

Sets a color key mask by specifying a range of colors to mask. Each color component of the range is specified by its min and max values. Min1, Max1, Min2, Max2, etc.

Param is a PdfParam object or parameter string specifying the color key masking parameters. These parameters are:

  • Min1, Max1,
    Min2, Max2,
    ...
    MinN, MaxN

    where N is the number of color components per sample. Each Min and Max value must be an integer in the range 0 to 2BitsPerComponent - 1.

For more information on color key masks, see Section 5.2.2 - Color Key Masking.


void SetColorSpace(PdfColorSpace ColorSpace)
Replaces the default color space for this image such as "DeviceRGB", etc. with the color space specified by ColorSpace. The number of color components of the specified color space must match that of the image.

void SetImageMask(PdfImage Image)
Sets an explicit image mask. Image must be a PdfImage object representing a monochrome bitmap which IsMap property is set to True. For more information about explicit image masks, see Section 5.2.1 - Explicit Masking.