|
THPDFPage.AddRichTextField
|
Вгору |
|
Додає на current page PDF 1.5+ AcroForm rich-text text widget (ISO 32000-1 12.7.4.3 + Annex L) Widget містить standard /V + /DV plain-text fallback для readers, що не parse rich text, плюс нові entries /RV rich-text XHTML body і /DS default style, які Acrobat і Foxit consume directly для styled text Flag /Ff RichText bit (26) OR'd automatically
Delphi syntax: procedure AddRichTextField(const FieldName, InitialValue: AnsiString; const RichValue, DefaultStyle: AnsiString; Rectangle: TRect; MaxLen: Integer = 0; Flags: THPDFFormFieldFlags = []);
C++ syntax: void AddRichTextField(const AnsiString& FieldName, const AnsiString& InitialValue, const AnsiString& RichValue, const AnsiString& DefaultStyle, const TRect& Rectangle, int MaxLen = 0, THPDFFormFieldFlags Flags = THPDFFormFieldFlags());
Опис Widget emitиться як Tx form field з /FT /Tx, /DA (/Helv 12 Tf 0 0 0 rg), /Ff з RichText bit set, supplied InitialValue як /V і /DV, RichValue як /RV і DefaultStyle як /DS InitialValue, RichValue і DefaultStyle auto-detect multi-byte content і switch to UTF-16BE hex-string encoding when needed (matching existing AddTextField behavior для international plain-text fields) Rich-text rendering відбувається у reader: Acrobat / Foxit / Edge / Chrome PDF viewer parse /RV, коли RichText bit on, і беруть Unicode font fallbacks із system, тому CJK, Cyrillic, Arabic і accented Latin content displays correctly без embedding CID font у /DR Resources Для власного path AutoFormAppearances HotPDF placeholder empty-AP branch для multi-byte text лишається (task v2.56.0+); rich-text-aware readers ignore that AP і render from /RV directly
FieldName - partial name /T PDF form field (має бути unique within parent) Spaces і non-ASCII bytes accepted; non-ASCII triggers UTF-16BE encoding on emitted /T string InitialValue - plain-text PDF text string, written to /V і /DV Readers, що не parse /RV, fallback to this value for display RichValue - PDF 1.7 Annex L tagged XHTML body (the most portable form starts with DefaultStyle - CSS-like style string applied to characters the user types at fill time when no per-character style is present in Rectangle - /Rect widget у HotPDF screen coordinates (top-left origin); YProjection happens automatically when rect converted to PDF user space MaxLen - optional; when greater than zero, emits a Flags - optional; будь-які extra field flags для OR into /Ff beyond auto-added RichText bit Типові extra flags: ffMultiline для multi-paragraph rich-text bodies, ffReadOnly для display-only formatted text Flag ffRichText always added, тому caller не потрібно include it
Code Example
See Also AddTextField, AutoFormAppearances, Version, AcroForm Support
|