You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For bug #4254, Ensure that multiple FreeText annotations are displayed as expected.
We also add the following new features:
1. Support for subtype FreeTextCallout
2. Support for rich text.
PDF only: Add text in a given rectangle. Optionally, the appearance of a "callout" shape can be requested by specifying two or three point-like objects -- see below.
194
201
195
-
PDF only: Add text in a given rectangle.
202
+
:arg rect_like rect: the rectangle into which the text should be inserted. Text is automatically wrapped to a new line at box width. Text portions not fitting into the rectangle will be invisible without warning.
196
203
197
-
:arg rect_like rect: the rectangle into which the text should be inserted. Text is automatically wrapped to a new line at box width. Lines not fitting into the box will be invisible.
204
+
:arg str text: the text. May contain any mixture of Latin, Greek, Cyrillic, Chinese, Japanese and Korean characters. If `richtext=True` (see below), the string is interpreted as HTML syntax. This adds a plethora of ways for attractive effects.
198
205
199
-
:arg str text: the text. May contain any mixture of Latin, Greek, Cyrillic, Chinese, Japanese and Korean characters. The respective required font is automatically determined. (New in v1.17.0)
200
-
:arg float fontsize: the :data:`fontsize`. Default is 12.
201
-
:arg str fontname: the font name. Default is "Helv".
202
-
Accepted alternatives are "Cour", "TiRo", "ZaDb" and "Symb".
203
-
The name may be abbreviated to the first two characters, like "Co" for "Cour".
204
-
Lower case is also accepted.
205
-
Bold or italic variants of the fonts are **not accepted** (changed in v1.16.0).
206
-
A user-contributed script provides a circumvention for this restriction -- see section *Using Buttons and JavaScript* in chapter :ref:`FAQ`.
207
-
The actual font to use is now determined on a by-character level, and all required fonts (or sub-fonts) are automatically included.
208
-
Therefore, you should rarely ever need to care about this parameter and let it default (except you insist on a serifed font for your non-CJK text parts). (New in v1.17.0)
206
+
:arg float fontsize: the :data:`fontsize`. Default is 11. Ignored if `richtext=True`.
207
+
208
+
:arg str fontname: The font name. Default is "Helv". Ignored if `richtext=True`, otherwise the following **restritions apply:**
209
209
210
-
:arg sequence,float text_color: the text color. Default is black. (New in v1.16.0)
210
+
* Accepted alternatives are "Helv" (Helvetica), "Cour" (Courier), "TiRo" (Timnes-Roman), "ZaDb" (ZapfDingBats) and "Symb" (Symbol). The name may be abbreviated to the first two characters, like "Co" for "Cour", lower case accepted.
211
211
212
-
:arg sequence,float fill_color: the fill color. Default is white. (New in v1.16.0)
213
-
:arg sequence,float text_color: the text color. Default is black.
214
-
:arg sequence,float border_color: the border color. Default is `None`. (New in v1.19.6)
215
-
:arg int align: text alignment, one of TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT - justify is **not supported**. (New in v1.17.0)
212
+
* Bold or italic variants of the fonts are **not supported.**
213
+
214
+
:arg list,tuple,float text_color: the text color. Default is black. Ignored if `richtext=True`.
216
215
217
-
:arg int rotate: the text orientation. Accepted values are 0, 90, 270, invalid entries are set to zero.
216
+
:arg list,tuple,float fill_color: the fill color. This is used for ``rect`` and the end point of the callout lines when applicable. Default is ``None``.
217
+
218
+
:arg list,tuple,float border_color: This parameter only has an effect if `richtext=True`. Otherwise, ``text_color`` is used.
219
+
220
+
:arg float border_width: the width of border and ``callout`` lines. Default is 0 (no border), in which case callout lines may still appear with some hairline width, depending on the PDF viewer used.
221
+
222
+
:arg list,tuple dashes: a list of floats specifying how border and callout lines should be dashed. Default is ``None``.
223
+
224
+
:arg list,tuple callout: a list / tuple of two or three :data:`point_like` objects, which will be interpreted as end point [, knee point] and start point (in this sequence) of up to two line segments, converting this annotation into a call-out shape.
225
+
226
+
:arg int line_end: the line end symbol of the call-out line. It is drawn at the first point specified in the `callout` list. Default is an open arrow. For possible values see :ref:`AnnotationLineEnds`.
227
+
228
+
:arg float opacity: a float `0 <= opacity < 1` turning the annotation transparent. Default is no transparency.
229
+
230
+
:arg int align: text alignment, one of TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT - justify is **not supported**. Ignored if `richtext=True`.
231
+
232
+
:arg int rotate: the text orientation. Accepted values are integer multiples of 90°. Invalid entries receive a rotation of 0.
233
+
234
+
:arg bool richtext: treat ``text`` as HTML syntax. This allows to achieve **bold**, *italic*, arbitrary text colors, font sizes, text alignment including justify and more - as far as HTML and styling instructions support this. This is similar to what happens in :meth:`Page.insert_htmlbox`. The base library will for example pull in required fonts if it encounters characters not contained in the standard ones. Some parameters are ignored if this option is set, as mentioned above. Default is ``False``.
235
+
236
+
:arg str style: supply optional HTML styling information in CSS syntax. Ignored if `richtext=False`.
218
237
219
238
:rtype::ref:`Annot`
220
-
:returns: the created annotation. Color properties **can only be changed** using special parameters of :meth:`Annot.update`. There, you can also set a border color different from the text color.
<span style="color:blue;">Here is some <b>bold</b> and <i>italic</i> text, followed by <b><i>bold-italic</i></b>. Text-based check boxes: {bullet}.</span>
0 commit comments