Class ImageContent
An image content element returned by the content-stream interpreter. Supports saving the decoded image to a file.
Inherited Members
Namespace: DRIT.Pdf.Content
Assembly: DRIT.Pdf.dll
Syntax
public sealed class ImageContent : ContentElement
Properties
Bounds
Bounding box of this element in the page's user-space coordinate system (origin at lower-left, y-up, units = points).
Declaration
public override PdfRect Bounds { get; }
Property Value
| Type | Description |
|---|---|
| PdfRect |
Overrides
ElementType
The type of this content element.
Declaration
public override ContentElementType ElementType { get; }
Property Value
| Type | Description |
|---|---|
| ContentElementType |
Overrides
Image
Image metadata (pixel size).
Declaration
public ImageData Image { get; }
Property Value
| Type | Description |
|---|---|
| ImageData |
Methods
Save(Stream, ImageSaveFormat, int)
Save the image to a stream in the requested format.
Declaration
public void Save(Stream stream, ImageSaveFormat format = ImageSaveFormat.Png, int jpegQuality = 85)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | Writable destination stream. |
| ImageSaveFormat | format | Target image format. |
| int | jpegQuality | JPEG quality in range 1-100. |
Save(string)
Save the image to a file. The output format is inferred from extension: .jpg / .jpeg => JPEG, .tif / .tiff => TIFF, otherwise PNG.
Declaration
public void Save(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |