ImageStamp
Overview
ImageStamp is a class in Aspose.PDF FOSS for .NET.
Inherits from: BaseParagraph.
Adds an image to a PDF page.
This class provides 12 methods for working with ImageStamp objects in .NET programs.
Available methods include: ApplyTo, Clone, FromGrayscale, FromJpeg, FromJpegStream, FromPngData, FromRgb, ImageStamp, Put, setStampId.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: AlternativeText, Background, DisplayHeight, DisplayWidth, Height, HorizontalAlignment, and 23 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
X | double | Read/Write | Position X in points from bottom-left. |
Y | double | Read/Write | Position Y in points from bottom-left. |
DisplayWidth | double | Read/Write | Display width in points. |
DisplayHeight | double | Read/Write | Display height in points. |
Width | double | Read/Write | Alias for DisplayWidth. |
Height | double | Read/Write | Alias for DisplayHeight. |
XIndent | double | Read/Write | Horizontal offset from the stamp’s anchor point. |
YIndent | double | Read/Write | Vertical offset from the stamp’s anchor point. |
Quality | int | Read/Write | JPEG quality (1..100). |
AlternativeText | string? | Read/Write | Tagged-PDF alternate text for accessibility. |
Background | bool | Read/Write | Whether the stamp is drawn behind the page content (true) or on top of it (false). |
Opacity | double | Read/Write | Opacity, 0.0 (transparent) … 1.0 (opaque). |
Zoom | double | Read/Write | Uniform zoom percentage applied to the image. |
ZoomX | double | Read/Write | Horizontal zoom percentage. |
ZoomY | double | Read/Write | Vertical zoom percentage. |
Rotate | Rotation | Read/Write | Rotation enum (0/90/180/270 in degrees). |
RotateAngle | double | Read/Write | Arbitrary rotation angle in degrees. |
StampId | int | Read/Write | The /StampId entry written into the stamp’s resource entry. |
Image | System.IO.Stream | Read | Read-only view of the original source bytes (or the decoded image bytes when constructed via FromRgb / FromGrayscale). |
HorizontalAlignment | HorizontalAlignment | Read/Write | Horizontal alignment applied to this paragraph. |
VerticalAlignment | VerticalAlignment | Read/Write | Vertical alignment applied to this paragraph. |
Margin | MarginInfo? | Read/Write | Outer-margin info applied to this paragraph. |
IsFirstParagraphInColumn | bool | Read/Write | Force the paragraph to start a new column. |
IsKeptWithNext | bool | Read/Write | Keep this paragraph on the same page as the next one. |
IsInNewPage | bool | Read/Write | Force the paragraph to start on a new page. |
IsInLineParagraph | bool | Read/Write | Inline paragraph flag (does not start a new line). |
HyperlinkText | string? | Read/Write | Legacy string-typed hyperlink target. |
Hyperlink | Hyperlink? | Read/Write | Typed hyperlink decoration applied to the paragraph. |
ZIndex | int | Read/Write | Z-order index used by the DOM renderer. |
Methods
| Signature | Description |
|---|---|
ImageStamp(image: System.IO.Stream) | Construct from an image stream (auto-detects JPEG vs PNG by header). |
ImageStamp(fileName: string) | Construct from an image file path (auto-detects JPEG vs PNG by header). |
setStampId(id: int) | Set the stamp’s PDF /StampId entry. |
Put(page: Page) | Alias for ApplyTo. |
FromRgb(pixelData: byte[], width: int, height: int) | Create an image stamp from raw RGB pixel data. |
FromGrayscale(pixelData: byte[], width: int, height: int) | Create an image stamp from raw grayscale pixel data. |
FromJpeg(jpegData: byte[], width: int, height: int) | Create an image stamp from JPEG bytes. |
FromJpeg(jpegData: byte[]) | Create an image stamp from JPEG bytes, auto-detecting dimensions from the JPEG header. |
FromJpegStream(jpegStream: Stream) | Create an image stamp from a JPEG file stream. |
FromPngData(pngData: byte[]) | Create an image stamp from PNG file data. |
ApplyTo(page: Page) | Add this image to a page. |
Clone() | Shallow clone — copies scalar/ref-shared state. |