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).
BottomBord inférieur de la boîte englobante (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

Appelez cette fonction après BeginTag ou BeginTagEx et avant EndTag ; les coordonnées suivent le système de coordonnées par défaut du PDF où l'origine se trouve en bas à gauche de la 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