Class PdfImage
A raster image that can be drawn on pages. Supported formats: JPEG (embedded unchanged), PNG (all color types and bit depths, transparency becomes a soft mask), BMP and GIF (decoded). Images are independent of documents; each document embeds an image only once, however often it is drawn.
public sealed class PdfImage
- Inheritance
-
PdfImage
- Inherited Members
Properties
AspectRatio
Width / height.
public double AspectRatio { get; }
Property Value
Height
Height in pixels.
public int Height { get; }
Property Value
Width
Width in pixels.
public int Width { get; }
Property Value
Methods
FromBytes(byte[])
Creates an image from JPEG, PNG, BMP or GIF data (detected by signature). JPEG is embedded as is; the others are decoded.
public static PdfImage FromBytes(byte[] data)
Parameters
databyte[]
Returns
FromFile(string)
Loads a JPEG, PNG, BMP or GIF file (see FromBytes(byte[])).
public static PdfImage FromFile(string path)
Parameters
pathstring
Returns
FromPixels(int, int, byte[], int, byte[]?)
Creates an image from raw 8-bit pixel data (RGB, gray or CMYK, row by row without padding), optionally with an 8-bit alpha channel.
public static PdfImage FromPixels(int width, int height, byte[] pixels, int components, byte[]? alpha = null)
Parameters
Returns
FromStream(Stream)
Reads JPEG, PNG, BMP or GIF data from a stream to its end (see FromBytes(byte[])); the stream is not closed.
public static PdfImage FromStream(Stream stream)
Parameters
streamStream