---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/Artifact
---

# Artifact

## Overview

`Artifact` is a class in Aspose.PDF FOSS for .NET.

Represents a PDF artifact — a marked content sequence tagged as /Artifact (PDF 32000 §14.8.2.2).

This class provides 16 methods for working with Artifact objects in .NET programs.
Available methods include: `Artifact`, `BeginUpdates`, `Dispose`, `GetValue`, `RemoveValue`, `SaveUpdates`, `SetImage`, `SetLinesAndState`, `SetPageNumberReplacementString`, `SetPdfPage`, `SetText`, `SetTextAndState`, and 1 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `ArtifactHorizontalAlignment`, `ArtifactVerticalAlignment`, `BackgroundColor`, `BottomMargin`, `Contents`, `CustomSubtype`, and 18 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Type` | `ArtifactType` | Read/Write | The artifact's type classification. |
| `Subtype` | `ArtifactSubtype` | Read/Write | The artifact's subtype. |
| `CustomType` | `string?` | Read/Write | Name of non-standard artifact type. |
| `CustomSubtype` | `string?` | Read/Write | Name of non-standard artifact subtype. |
| `Text` | `string?` | Read/Write | Text content extracted from the artifact's content stream operators. |
| `Rectangle` | `Rectangle?` | Read | Bounding box from the /BBox entry in the properties dictionary. |
| `Opacity` | `double` | Read/Write | Opacity of the artifact (from ExtGState /ca). |
| `Page` | `Page?` | Read | The page this artifact belongs to. |
| `ArtifactHorizontalAlignment` | `HorizontalAlignment` | Read/Write | Horizontal alignment (from /Attached entry). |
| `ArtifactVerticalAlignment` | `VerticalAlignment` | Read/Write | Vertical alignment (from /Attached entry). |
| `IsBackground` | `bool` | Read/Write | Whether this is a background artifact. |
| `Rotation` | `double` | Read/Write | Rotation angle in degrees. |
| `BackgroundColor` | `Color?` | Read/Write | Background color. |
| `RightMargin` | `double` | Read/Write | Right margin. |
| `LeftMargin` | `double` | Read/Write | Left margin. |
| `TopMargin` | `double` | Read/Write | Top margin. |
| `BottomMargin` | `double` | Read/Write | Bottom margin. |
| `Position` | `Point?` | Read/Write | Explicit placement coordinates. |
| `FormattedText` | `FormattedText?` | Read/Write | Formatted text for the artifact. |
| `TextState` | `TextState?` | Read/Write | Text state for artifact text. |
| `Lines` | `List` | Read | Multi-line text content. |
| `Contents` | `List` | Read | Internal content-stream operators that draw the artifact. |
| `Form` | `XForm?` | Read | The Form XObject backing this artifact when it is rendered as a reusable form (e.g. |
| `Image` | `XImage?` | Read | The Image XObject backing this artifact when its content is a raster image. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Artifact()` | Default constructor — creates an artifact with Undefined type and subtype. |
| `Artifact(type: ArtifactType, subType: ArtifactSubtype)` | Creates an artifact with the given type and subtype. |
| `Artifact(type: string, subType: string)` | Creates an artifact with string-based custom type and subtype. |
| `SetPageNumberReplacementString(value: string)` | Sets the page-number replacement token used in Text. |
| `SetLinesAndState(text: string[], textState: TextState)` | Sets multi-line text content with the given text state. |
| `BeginUpdates()` | Begin a batched property update. |
| `SaveUpdates()` | Flush a batched update started by BeginUpdates. |
| `Dispose()` | Releases resources held by the artifact. |
| `GetValue(name: string)` | Read a custom name/value pair set via SetValue(string, string). |
| `SetValue(name: string, value: string)` | Store a custom name/value pair on the artifact (for downstream metadata access; not emitted into the PDF in this build). |
| `RemoveValue(name: string)` | Remove a custom name/value pair previously set via SetValue. |
| `SetImage(imageStream: Stream)` | Attach a raster image to the artifact. |
| `SetImage(imageName: string)` | Attach a raster image by path. |
| `SetText(formattedText: FormattedText)` | Set the artifact text from a FormattedText instance. |
| `SetTextAndState(text: string, textState: TextState)` | Set Text and TextState together. |
| `SetPdfPage(page: Page)` | Bind this artifact to a specific page. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)