SetStructElemLang
Tagged PDF & Accessibility
Descrição
Define a entrada /Lang no elemento de estrutura em construção no momento na pilha de tags. A tag de idioma sobrepõe o idioma de nível de documento para este elemento e todos os seus descendentes, permitindo que documentos em idiomas mistos declarem o idioma natural correto para cada trecho de conteúdo
Sintaxe
Delphi
Function TPDFlib.SetStructElemLang(Const Lang: WideString): Integer;
ActiveX
Function PDFlib::SetStructElemLang(Lang As String) As Long
DLL
int DLSetStructElemLang(int InstanceID, const wchar_t * Lang);
Parâmetros
| Lang | A BCP 47 language tag string, such as en-US, fr, de-CH, or zh-Hant-TW. Pass an empty string to clear a previously set value and inherit the document-level language. |
|---|
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. It is equivalent to passing a non-empty Lang argument to BeginTagEx, but may be more convenient when the language is determined separately from the element type.
The element-level /Lang entry is defined in ISO 32000-1 §14.9.2. It applies to the structure element and, by inheritance, to all child elements that do not themselves declare a /Lang. Screen readers use this entry to select the appropriate text-to-speech voice or language engine when reading the document aloud.
PDF/UA-1 (ISO 14289-1 §7.3) requires that all natural language content be identified. The document-level /Lang set by SetDocumentLanguage or SetPDFUAMode covers the primary language; SetStructElemLang covers sections whose language differs from the primary.
Exemplo
// A French phrase embedded in an English document
PDFlib.SetPDFUAMode('en-US');
// ... English content
PDFlib.BeginTag('P', '', '');
PDFlib.SetStructElemLang('fr');
PDFlib.TextOut(x, y, 'Bonjour le monde');
PDFlib.EndTag;See also
BeginTagEx, SetDocumentLanguage, SetPDFUAMode, SetStructElemActualText, GetPDFUADiagnostics