SetStructElemBBox

Tagged PDF, Accessibility

Description

Sets the /BBox attribute (Layout attribute owner) on the structure element currently open on the tag stack. The bounding box associates a rectangular region in user-space coordinates with the structure element, which is used by accessibility tools and re-flow engines. Equivalent to calling AddTagAttribute with Owner=Layout, Name=BBox, and a space-separated coordinate string.

Syntax

Delphi

function TPDFlib.SetStructElemBBox(Left, Bottom, Right, Top: Double): Integer;

ActiveX

Function PDFlib::SetStructElemBBox(Left As Double, Bottom As Double, Right As Double, Top As Double) As Long

DLL

int DLSetStructElemBBox(int InstanceID, double Left, double Bottom, double Right, double Top);

Parameters

LeftLeft edge of the bounding box in default user space units (points, 1/72 inch).
BottomBottom edge of the bounding box.
RightRight edge of the bounding box.
TopTop edge of the bounding box.

Return value

Returns 1 on success. Returns 0 if no document is open or no tag is currently open on the tag stack.

Remarks

Call this function after BeginTag or BeginTagEx and before EndTag. The coordinates follow the PDF default coordinate system where the origin is at the bottom-left of the page.

The /BBox attribute is defined in ISO 32000-1 ยง14.8.5.4 (Layout attribute owner). It is particularly useful for Figure, Form, and Formula structure element types.

Example

var
  ImgX, ImgY, ImgW, ImgH: Double;
begin
  // Draw an image and tag it as a Figure with its bounding box
  ImgX := 72; ImgY := 600; ImgW := 150; ImgH := 100;
  PDFlib.BeginTag('Figure', 'Product photo', '', '');
  PDFlib.SetStructElemBBox(ImgX, ImgY, ImgX + ImgW, ImgY + ImgH);
  PDFlib.DrawImageMatrix(ImgID, ImgX, ImgY, ImgW, ImgH, 0);
  PDFlib.EndTag;
end;

See also

AddTagAttribute, SetStructElemScope, BeginTag, EndTag