Class PdfExtractedImage
An image found on a page or in an annotation appearance.
public sealed class PdfExtractedImage
- Inheritance
-
PdfExtractedImage
- Inherited Members
Properties
Bounds
Position on the page (default user space).
public PdfRectangle Bounds { get; }
Property Value
HasTransparency
True if the image has a soft mask or stencil mask (transparency).
public bool HasTransparency { get; }
Property Value
Height
Height of the image in pixels (the /Height entry; 0 if missing).
public int Height { get; }
Property Value
IsJpeg
True for JPEG images (DCTDecode); GetEncodedData() returns a complete JPEG file.
public bool IsJpeg { get; }
Property Value
IsJpeg2000
True for JPEG 2000 images; GetEncodedData() returns a JPEG 2000 file.
public bool IsJpeg2000 { get; }
Property Value
Name
Resource name (null for inline images).
public string? Name { get; }
Property Value
Stream
The image XObject (or the expanded inline image).
public PdfStream Stream { get; }
Property Value
Transform
Transformation from the unit square to page coordinates.
public Matrix Transform { get; }
Property Value
Width
Width of the image in pixels (the /Width entry; 0 if missing).
public int Width { get; }
Property Value
Methods
GetEncodedData()
The data with all non-image filters removed (for JPEG/JPEG 2000 the original file data).
public byte[] GetEncodedData()
Returns
- byte[]
ToFile(out string)
Returns the image as a file: JPEG data for JPEG images without transparency, otherwise PNG (null if not decodable).
public byte[]? ToFile(out string extension)
Parameters
extensionstring
Returns
- byte[]
ToPng(PdfColor?)
Decodes the image to PNG (with alpha channel from /SMask, /Mask or stencil masks). Returns null if the image cannot be decoded (JPEG, JPEG 2000, JBIG2, CCITT, Lab color) โ use GetEncodedData() for JPEG.
public byte[]? ToPng(PdfColor? background = null)
Parameters
backgroundPdfColor?If set, transparency is composited onto this color (the PNG has no alpha channel).
Returns
- byte[]
ToString()
Returns the resource name (or "inline"), the pixel size and the bounds, for debugging.
public override string ToString()