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

NameTypeAccessDescription
TypeArtifactTypeRead/WriteThe artifact’s type classification.
SubtypeArtifactSubtypeRead/WriteThe artifact’s subtype.
CustomTypestring?Read/WriteName of non-standard artifact type.
CustomSubtypestring?Read/WriteName of non-standard artifact subtype.
Textstring?Read/WriteText content extracted from the artifact’s content stream operators.
RectangleRectangle?ReadBounding box from the /BBox entry in the properties dictionary.
OpacitydoubleRead/WriteOpacity of the artifact (from ExtGState /ca).
PagePage?ReadThe page this artifact belongs to.
ArtifactHorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment (from /Attached entry).
ArtifactVerticalAlignmentVerticalAlignmentRead/WriteVertical alignment (from /Attached entry).
IsBackgroundboolRead/WriteWhether this is a background artifact.
RotationdoubleRead/WriteRotation angle in degrees.
BackgroundColorColor?Read/WriteBackground color.
RightMargindoubleRead/WriteRight margin.
LeftMargindoubleRead/WriteLeft margin.
TopMargindoubleRead/WriteTop margin.
BottomMargindoubleRead/WriteBottom margin.
PositionPoint?Read/WriteExplicit placement coordinates.
FormattedTextFormattedText?Read/WriteFormatted text for the artifact.
TextStateTextState?Read/WriteText state for artifact text.
LinesList<string>ReadMulti-line text content.
ContentsList<Operator>ReadInternal content-stream operators that draw the artifact.
FormXForm?ReadThe Form XObject backing this artifact when it is rendered as a reusable form (e.g.
ImageXImage?ReadThe Image XObject backing this artifact when its content is a raster image.

Methods

SignatureDescription
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