EndArtifact

Tagged PDF, Accessibility

Description

Closes the most recently opened artifact region, writing an EMC (End Marked Content) operator to the current page's content stream. Every call to BeginArtifact must be matched by exactly one EndArtifact call.

Syntax

Delphi

function TPDFlib.EndArtifact: Integer;

ActiveX

Function PDFlib::EndArtifact As Long

DLL

int DLEndArtifact(int InstanceID);

Return values

0Failed — no document is open or no artifact region is currently open.
1The artifact region was closed successfully.

Remarks

Artifact regions and structure elements share the same marked-content stack for the current page. EndArtifact only closes the topmost open region if it was opened with BeginArtifact; never use it to close a structure element opened with BeginTag or its variants — call EndTag for those.

Artifact regions may be nested inside structure elements when the artifact represents a decorative graphic that belongs visually with structural content. They may not, however, contain structure elements: PDF readers will warn or refuse to honour structure inside an artifact.

Typical artifact subtypes that justify a separate region are page headers, footers, page numbers, decorative borders, watermarks, and background images. Marking those as artifacts keeps them out of the reading order that assistive technology presents to the user.

Example

// Running footer drawn once per page, as an artifact
PDF.BeginArtifact('Footer');
PDF.SetFontSize(8);
PDF.PrintText(50, 30, 'Annual Report 2026 — page ' + IntToStr(pageNo));
PDF.EndArtifact;

// Page header with the company logo, also an artifact
PDF.BeginArtifact('Header');
PDF.DrawImage(50, 800, 60, 30, logoHandle);
PDF.EndArtifact;

See also

BeginArtifact, BeginTag, EndTag, SetPDFUAMode