PdfImage Object

Overview

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

Member List

Properties


BitsPerComponent As Long (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.

ColorSpace As String (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.

ComponentsPerSample As Long (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.

Format As String (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.


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

Hyperlinks As PdfTextItems (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.


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

NextImage As PdfImage (Read-only)

Returns the next image in the sequence generated by the PdfDocument.OpenUrl method, or Nothing 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 Nothing .

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


ResolutionX As Single (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.

ResolutionY As Single (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.

TransparencyColor As PdfParam (Read-only)

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

This property was introduced in version 1.6 and made obsolete in version 1.6.0.3.


TransparencyColorExists As Boolean (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 was introduced in version 1.6 and made obsolete in version 1.6.0.3.


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

Methods


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

Sub SetColorMask(Param As Variant)

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.


Sub SetColorSpace(ColorSpace As PdfColorSpace)
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.

Sub SetImageMask(Image As PdfImage)
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.