Back to DOM
ImageContentClass
Definition
- Namespace
- DOM.Elements.Graphics
- Assembly
- DOM.dll
Represents the binary payload of an as a Base64-encoded string. Image
Remarks
is a lightweight wrapper around the raw image bytes. Storing the payload as Base64 keeps the DOM pure string data and simplifies serialization to WordprocessingML, HTML data URIs, and PDF object streams. ImageContent An implicit conversion from is provided so that Base64 content can be assigned directly to an property. String ImageContent
Examples
csharp
1// 1. Assign Base64 content directly via implicit conversion
2ImageContent c = "iVBORw0KGgoAAAANSUhEUgAA...";
3
csharp
1// 2. Create from an explicit Base64 string
2var bytes = File.ReadAllBytes("logo.png");
3var content = new ImageContent { Content = Convert.ToBase64String(bytes) };
4
csharp
1// 3. Retrieve the raw bytes for export
2var raw = Convert.FromBase64String(image.ImageContent.Content);
3
csharp
1// 4. Use with an Image loaded from disk
2var img = new Image("photo.png");
3string base64 = img.ImageContent.Content;
4
Properties
Contentstring
Gets or sets the Base64-encoded image payload.
Methods
Implicitly converts a Base64 to an . String, ImageContent