SetStructElemAltTextA
Tagged PDF & Accessibility
คำอธิบาย
อักษร A ที่ต่อท้ายหมายถึงจุดเข้า DLL แบบ ANSI (char); ส่วนติดต่อ ActiveX/COM เปิดเผยเฉพาะรูปแบบ Unicode เท่านั้น พฤติกรรมเหมือนกับ SetStructElemAltText และอาร์กิวเมนต์สตริงจะถูกตีความโดยใช้หน้ารหัส SetAnsiMode ปัจจุบัน
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.
ฟังก์ชันนี้เทียบเท่ากับการส่ง AltText ที่ไม่ว่างให้ BeginTag หรือ BeginTagEx แต่ตั้งหรืออัปเดตข้อความทางเลือกหลังเปิดองค์ประกอบไปแล้วได้ มีประโยชน์เมื่อคำอธิบายถูกคำนวณหรือดึงแบบ async หลังรู้ชนิดองค์ประกอบแล้ว
ไวยากรณ์
Delphi
Function DLSetStructElemAltTextA(InstanceID: Integer; AltText: PAnsiChar): Integer;
DLL
int DLSetStructElemAltTextA(int InstanceID, const char * AltText);
พารามิเตอร์
| AltText | ข้อความคำอธิบายทางเลือกที่จะผูกกับองค์ประกอบโครงสร้างปัจจุบัน ส่งสตริงว่างเพื่อล้างค่าที่ตั้งไว้ก่อนหน้า |
|---|
Return value
คืนค่า 1 เมื่อสำเร็จ, 0 ถ้าไม่มีองค์ประกอบโครงสร้างเปิดอยู่ปัจจุบันหรือไม่มีเอกสารที่เลือกอยู่
Remarks
เรียกฟังก์ชันนี้ทันทีหลัง BeginTag ขณะที่องค์ประกอบเป้าหมายยังอยู่บนสุดของสแตกแท็ก หรือจะเรียกเมื่อไหร่ก็ได้ก่อนถึงคู่ EndTag
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.
ตัวอย่าง
// 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;ดูเพิ่มเติม
BeginTag, BeginTagEx, SetStructElemActualText, SetStructElemLang, GetPDFUADiagnostics