SetStructElemActualText
Tagged PDF & Accessibility
Descrição
Define a entrada /ActualText no elemento de estrutura em construção no momento na pilha de tags. ActualText fornece o texto Unicode exato que o elemento representa, sobrepondo qualquer texto extraído do content stream do PDF pelo software leitor
Use this function when the glyphs rendered in the content stream do not directly map to their intended reading-order characters — for example, a ligature glyph (ff, fi, fl) that should read as the two-character sequence ff, fi, or fl. Without ActualText, text-extraction tools and screen readers may produce incorrect output for such glyphs.
Sintaxe
Delphi
Function TPDFlib.SetStructElemActualText(Const ActualText: WideString): Integer;
ActiveX
Function PDFlib::SetStructElemActualText(ActualText As String) As Long
DLL
int DLSetStructElemActualText(int InstanceID, const wchar_t * ActualText);
Parâmetros
| ActualText | The Unicode text string to associate with the current structure element. Pass an empty string to clear a previously set value. |
|---|
Valor de retorno
Retorna 1 em caso de sucesso, 0 se nenhum elemento de estrutura estiver aberto ou nenhum documento estiver selecionado
Remarks
Call this function immediately after BeginTag or BeginTagEx while the target element is at the top of the tag stack.
ActualText and AltText serve different purposes. AltText (set via the AltText parameter of BeginTag) is an alternative representation of the entire element intended for assistive technology when the visual content cannot be rendered. ActualText supplements content-stream text extraction: it replaces the extracted character sequence of the element but does not suppress rendering. Screen readers that support both will typically use ActualText for read-aloud output when present.
ISO 32000-1 §14.9.4 defines ActualText as a PDF text string entry on the structure element dictionary. PDF/UA-1 (ISO 14289-1 §7.1) requires that text content be extractable and correct; ActualText is the standard mechanism to satisfy this requirement for glyph sequences whose direct extraction would be ambiguous or incorrect.
Exemplo
// Tag a ligature glyph so that text extraction yields "fi"
PDFlib.BeginTag('Span', '', '');
PDFlib.SetStructElemActualText('fi');
PDFlib.TextOut(x, y, #$FB01); // U+FB01 LATIN SMALL LIGATURE FI
PDFlib.EndTag;See also
BeginTag, BeginTagEx, SetStructElemID, AddTagAttribute, GetPDFUADiagnostics