SetStructElemAltTextA

Tagged PDF & Accessibility

Mô tả

Ký tự A ở cuối biểu thị điểm vào DLL ANSI (char); bề mặt ActiveX/COM chỉ cung cấp dạng Unicode. Hành vi giống hệt với SetStructElemAltText và các đối số chuỗi được diễn giải theo trang mã SetAnsiMode hiện tại

Sets the /Alt entry on the structure element currently being built on the tag stack. Alternative text is the text description that assistive technology (screen readers, braille displays) presents to users when the element cannot be rendered visually — for example, an image, figure, or mathematical formula.

Hàm này tương đương với việc truyền tham số AltText khác rỗng cho BeginTag hoặc BeginTagEx, nhưng cho phép đặt hoặc cập nhật văn bản thay thế sau khi phần tử đã được mở. Hữu ích khi mô tả được tính toán hay lấy về không đồng bộ sau khi đã biết kiểu phần tử

Cú pháp

Delphi

Function DLSetStructElemAltTextA(InstanceID: Integer; AltText: PAnsiChar): Integer;

DLL

int DLSetStructElemAltTextA(int InstanceID, const char * AltText);

Tham số

AltTextMô tả văn bản thay thế gắn với structure element hiện tại. Truyền chuỗi rỗng để xóa giá trị đã đặt trước đó

Return value

Returns 1 on success, 0 if no structure element is currently open or no document is selected.

Remarks

Gọi hàm này ngay sau BeginTag khi phần tử đích đang ở đỉnh tag stack, hoặc bất cứ lúc nào trước lời gọi EndTag tương ứng

AltText and ActualText serve different purposes. AltText is a complete textual substitute for the entire element — it replaces the visual content for users who cannot perceive the rendered output. ActualText (ISO 32000-1 §14.9.4) provides the exact Unicode character sequence for inline glyphs whose extracted text would otherwise be incorrect (such as ligatures), and does not replace rendering. Screen readers typically speak AltText for Figure and Formula elements, and use ActualText for character-level corrections.

ISO 32000-1 §14.9.3 defines the /Alt entry. PDF/UA-1 (ISO 14289-1 §7.5) requires alternative descriptions on Figure and Formula structure elements. GetPDFUADiagnostics reports the FIGURE-NO-ALT:N issue code when Figure or Formula elements are missing Alt text.

Ví dụ

// Tag an embedded chart image with alternative text
PDFlib.BeginTag('Figure', '', '');
PDFlib.SetStructElemAltText('Bar chart: Q1 sales 120, Q2 sales 145, Q3 sales 98');
PDFlib.SetStructElemBBox(x, y, x + w, y + h);
PDFlib.DrawImage(imgHandle, x, y, w, h);
PDFlib.EndTag;

Xem thêm

BeginTag, BeginTagEx, SetStructElemActualText, SetStructElemLang, GetPDFUADiagnostics