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
**PDF only**: Add a redaction annotation. A redaction annotation identifies content to be removed from the document. Adding such an annotation is the first of two steps. It makes visible what will be removed in the subsequent step, :meth:`Page.apply_redactions`.
303
+
**PDF only**: Add a redaction annotation. A redaction annotation identifies an area whose content should be removed from the document. Adding such an annotation is the first of two steps. It makes visible what will be removed in the subsequent step, :meth:`Page.apply_redactions`.
304
304
305
305
:arg quad_like,rect_like quad: specifies the (rectangular) area to be removed which is always equal to the annotation rectangle. This may be a :data:`rect_like` or :data:`quad_like` object. If a quad is specified, then the enveloping rectangle is taken.
306
306
307
307
:arg str text: text to be placed in the rectangle after applying the redaction (and thus removing old content). (New in v1.16.12)
308
308
309
-
:arg str fontname: the font to use when *text* is given, otherwise ignored. The same rules apply as for :meth:`Page.insert_textbox` -- which is the method :meth:`Page.apply_redactions` internally invokes. The replacement text will be **vertically centered**, if this is one of the CJK or :ref:`Base-14-Fonts`. (New in v1.16.12)
310
-
311
-
.. note::
312
-
313
-
* For an **existing** font of the page, use its reference name as *fontname* (this is *item[4]* of its entry in :meth:`Page.get_fonts`).
314
-
* For a **new, non-builtin** font, proceed as follows::
315
-
316
-
page.insert_text(point, # anywhere, but outside all redaction rectangles
317
-
"something", # some non-empty string
318
-
fontname="newname", # new, unused reference name
319
-
fontfile="...", # desired font file
320
-
render_mode=3, # makes the text invisible
321
-
)
322
-
page.add_redact_annot(..., fontname="newname")
309
+
:arg str fontname: the font to use when ``text`` is given, otherwise ignored. Only CJK and the :ref:`Base-14-Fonts` are supported. Apart from this, the same rules apply as for :meth:`Page.insert_textbox` -- which is what the method :meth:`Page.apply_redactions` internally invokes.
323
310
324
311
:arg float fontsize: the :data:`fontsize` to use for the replacing text. If the text is too large to fit, several insertion attempts will be made, gradually reducing the :data:`fontsize` to no less than 4. If then the text will still not fit, no text insertion will take place at all. (New in v1.16.12)
325
312
326
-
:arg int align: the horizontal alignment for the replacing text. See :meth:`insert_textbox` for available values. The vertical alignment is (approximately) centered if a PDF built-in font is used (CJK or :ref:`Base-14-Fonts`). (New in v1.16.12)
313
+
:arg int align: the horizontal alignment for the replacing text. See :meth:`insert_textbox` for available values. The vertical alignment is (approximately) centered.
327
314
328
315
:arg sequence fill: the fill color of the rectangle **after applying** the redaction. The default is *white = (1, 1, 1)*, which is also taken if ``None`` is specified. To suppress a fill color altogether, specify ``False``. In this cases the rectangle remains transparent. (New in v1.16.12)
Copy file name to clipboardExpand all lines: docs/rect.rst
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,11 +104,11 @@ The following remarks are also valid for :ref:`IRect` objects:
104
104
105
105
If "rect" is specified, the constructor creates a **new copy** of it.
106
106
107
-
Without parameters, the empty rectangle *Rect(0.0, 0.0, 0.0, 0.0)* is created.
107
+
Without parameters, the empty rectangle ``Rect(0.0, 0.0, 0.0, 0.0)`` is created.
108
108
109
109
.. method:: round()
110
110
111
-
Creates the smallest containing :ref:`IRect`. This is **not** the same as simply rounding the rectangle's edges: The top left corner is rounded upwards and to the left while the bottom right corner is rounded downwards and to the right.
111
+
Creates the smallest containing :ref:`IRect`. This is **not the same** as simply rounding the rectangle's edges: The top left corner is rounded upwards and to the left while the bottom right corner is rounded downwards and to the right.
@@ -131,7 +131,7 @@ The following remarks are also valid for :ref:`IRect` objects:
131
131
Transforms the rectangle with a matrix and **replaces the original**. If the rectangle is empty or infinite, this is a no-operation.
132
132
133
133
:arg m: The matrix for the transformation.
134
-
:type m::ref:`Matrix`
134
+
:type m::data:`matrix_like`
135
135
136
136
:rtype: *Rect*
137
137
:returns: the smallest rectangle that contains the transformed original.
@@ -141,21 +141,21 @@ The following remarks are also valid for :ref:`IRect` objects:
141
141
The intersection (common rectangular area, largest rectangle contained in both) of the current rectangle and *r* is calculated and **replaces the current** rectangle. If either rectangle is empty, the result is also empty. If *r* is infinite, this is a no-operation. If the rectangles are (mathematically) disjoint sets, then the result is invalid. If the result is valid but empty, then the rectangles touch each other in a corner or (part of) a side.
142
142
143
143
:arg r: Second rectangle
144
-
:type r::ref:`Rect`
144
+
:type r::data:`rect_like`
145
145
146
146
.. method:: include_rect(r)
147
147
148
-
The smallest rectangle containing the current one and *r* is calculated and **replaces the current** one. If either rectangle is infinite, the result is also infinite. If one is empty, the other one will be taken as the result.
148
+
The smallest rectangle containing the current one and ``r`` is calculated and **replaces the current** one. If either rectangle is infinite, the result is also infinite. If ``r`` is empty, the current rectangle remains unchanged. Else if the current rectangle is empty, it is replaced by ``r``.
149
149
150
150
:arg r: Second rectangle
151
-
:type r::ref:`Rect`
151
+
:type r::data:`rect_like`
152
152
153
153
.. method:: include_point(p)
154
154
155
-
The smallest rectangle containing the current one and point *p* is calculated and **replaces the current** one. **The infinite rectangle remains unchanged.** To create a rectangle containing a series of points, start with (the empty) *pymupdf.Rect(p1, p1)* and successively include the remaining points.
155
+
The smallest rectangle containing the current one and :data:`point_like` ``p`` is calculated and **replaces the current** one. **The infinite rectangle remains unchanged.** To create the rectangle that wraps a sequence of points, start with :meth:`EMPTY_RECT` and successively include the members of the sequence.
0 commit comments