Skip to content

Commit 3460e77

Browse files
committed
minor documentation updates
1 parent eb1a43d commit 3460e77

File tree

9 files changed

+97
-79
lines changed

9 files changed

+97
-79
lines changed

docs/annot.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ There is a parent-child relationship between an annotation and its page. If the
146146

147147
.. method:: setRotation(angle)
148148

149-
Set the rotation of an annotation. This rotates the annotation rectangle around its center point. Then a **new rectangle** is calculated which replaces the existing one.
149+
Set the rotation of an annotation. This rotates the annotation rectangle around its center point. Then a **new annotation rectangle** is calculated from the resulting quad.
150150

151-
:arg int angle: rotation angle in degrees. Arbitrary values are possible, but will be replaced by equivalent values 0 <= angle < 360.
151+
:arg int angle: rotation angle in degrees. Arbitrary values are possible, but will be clamped to the interval 0 <= angle < 360.
152152

153153
.. note::
154154
* You **must invoke** :meth:`Annot.update` to activate the effect.
155-
* For PDF_ANNOT_FREE_TEXT, only the four values 0, 90, 180 and 270 are possible and will only **rotate the text** inside the current rectangle (which remains unchanged). Other values are silently ignored and treated as 0.
156-
* Otherwise, only the following `AnnotationTypes`_ can be rotated: 'Square', 'Circle', 'Caret', 'Text', 'FileAttachment', 'Ink', 'Line', 'Polyline', 'Polygon', and 'Stamp'. For all others the method is a no-op.
155+
* For PDF_ANNOT_FREE_TEXT, only one of the values 0, 90, 180 and 270 is possible and will **rotate the text** inside the current rectangle (which remains unchanged). Other values are silently ignored and replaced by 0.
156+
* Otherwise, only the following :ref:`AnnotationTypes` can be rotated: 'Square', 'Circle', 'Caret', 'Text', 'FileAttachment', 'Ink', 'Line', 'Polyline', 'Polygon', and 'Stamp'. For all others the method is a no-op.
157157

158158

159159
.. method:: setBorder(border=None, width=0, style=None, dashes=None)
@@ -225,7 +225,7 @@ There is a parent-child relationship between an annotation and its page. If the
225225
* 'Line', 'Polyline', 'Polygon' annotations: use it to give applicable line end symbols a fill color other than that of the annotation *(changed in v1.16.16)*.
226226

227227
:arg bool cross_out: *(new in v1.17.2)* add two diagonal lines to the annotation rectangle. 'Redact' annotations only. If not desired, *False* must be specified even if the annotation was created with *False*.
228-
:arg int rotate: new rotation value. Default (-1) means no change. Supports 'FreeText' and several other annotation types (see `Annot.setRotation`), [#f1]_. Only choose 0, 90, 180, or 270 degrees for 'FreeText'. Otherwise any integer is acceptable.
228+
:arg int rotate: new rotation value. Default (-1) means no change. Supports 'FreeText' and several other annotation types (see :meth:`Annot.setRotation`), [#f1]_. Only choose 0, 90, 180, or 270 degrees for 'FreeText'. Otherwise any integer is acceptable.
229229

230230
:rtype: bool
231231

docs/classes.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ Classes
55
.. toctree::
66
:maxdepth: 2
77

8-
annot.rst
9-
colorspace.rst
10-
displaylist.rst
11-
document.rst
12-
font.rst
13-
identity.rst
14-
irect.rst
15-
link.rst
16-
linkdest.rst
17-
matrix.rst
18-
outline.rst
19-
page.rst
20-
pixmap.rst
21-
point.rst
22-
quad.rst
23-
rect.rst
24-
shape.rst
25-
textpage.rst
26-
textwriter.rst
27-
tools.rst
28-
widget.rst
8+
annot
9+
colorspace
10+
displaylist
11+
document
12+
font
13+
identity
14+
irect
15+
link
16+
linkdest
17+
matrix
18+
outline
19+
page
20+
pixmap
21+
point
22+
quad
23+
rect
24+
shape
25+
textpage
26+
textwriter
27+
tools
28+
widget

docs/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
templates_path = ["_templates"]
3030

3131
# The suffix of source filenames.
32-
source_suffix = ".rst"
32+
# source_suffix = ".rst"
3333

3434
# The encoding of source files.
3535
# source_encoding = 'utf-8-sig'
@@ -95,9 +95,9 @@
9595
# The theme to use for HTML and HTML Help pages. See the documentation for
9696
# a list of builtin themes.
9797
# html_theme = "agogo"
98-
html_theme = "sphinxdoc"
98+
# html_theme = "sphinxdoc"
9999
# html_theme = "python_docs_theme"
100-
# html_theme = "sphinx_rtd_theme"
100+
html_theme = "sphinx_rtd_theme"
101101
# html_theme = "classic"
102102

103103
# Theme options are theme-specific and customize the look and feel of a theme
@@ -165,8 +165,8 @@
165165
html_split_index = True
166166

167167
# If true, links to the reST sources are added to the pages.
168-
html_show_sourcelink = False
169-
168+
html_show_sourcelink = True
169+
html_sourcelink_suffix = ".rst"
170170
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
171171
html_show_sphinx = True
172172

@@ -176,10 +176,10 @@
176176
# If true, an OpenSearch description file will be output, and all pages will
177177
# contain a <link> tag referring to it. The value of this option must be the
178178
# base URL from which the finished HTML is served.
179-
# html_use_opensearch = ""
179+
html_use_opensearch = "https://pymupdf.readthedocs.io/en/latest"
180180

181181
# This is the file name suffix for HTML files (e.g. ".xhtml").
182-
html_file_suffix = ".html"
182+
# html_file_suffix = ".html"
183183

184184
# Output file base name for HTML help builder.
185185
htmlhelp_basename = "PyMuPDF"

docs/index.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
.. toctree::
55
:maxdepth: 4
66

7-
intro.rst
8-
installation.rst
9-
tutorial.rst
10-
faq.rst
11-
module.rst
12-
classes.rst
13-
algebra.rst
14-
lowlevel.rst
15-
glossary.rst
16-
vars.rst
17-
colors.rst
18-
app1.rst
19-
app2.rst
20-
app3.rst
21-
app4.rst
22-
changes.rst
7+
intro
8+
installation
9+
tutorial
10+
faq
11+
module
12+
classes
13+
algebra
14+
lowlevel
15+
glossary
16+
vars
17+
colors
18+
app1
19+
app2
20+
app3
21+
app4
22+
changes

docs/lowlevel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Contains a number of functions and classes for the experienced user. To be used
66
.. toctree::
77
:maxdepth: 1
88

9-
functions.rst
10-
device.rst
11-
coop_low.rst
9+
functions
10+
device
11+
coop_low

docs/page.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ In a nutshell, this is what you can do with PyMuPDF:
2121
* Add annotations and form fields.
2222

2323
.. note::
24-
Many methods require coordinates (mostly points or rectangles) to put new content in the right place. Please be aware that these coordinates **must always** be provided relative to the **unrotated** page. And vice versa: all methods / attributes returning coordinates of page objects will present them as if the page were not rotated. This applies to text extraction, annotation rectangles, image bboxes, etc.
2524

26-
So the returned value of e.g. :meth:`Page.getImageBbox` will not change if you do a :meth:`Page.setRotation`. The same is true for coordinates returned by :meth:`Page.getText`, annotation rectangles, and so on. If you want to find out, where an object is located in **rotated coordinates**, multiplay the coordinates by :attr:`Page.rotationMatrix`. There also is its inverse, :attr:`Page.derotationMatrix`, which you can use when interfacing with other readers, which may behave differently in this respect.
25+
Methods require coordinates (points, rectangles) to put content in desired places. Please be aware that since v1.17.0 these coordinates **must always** be provided relative to the **unrotated** page. The reverse is also true: all coordinates returned by methods and attributes pertain to the unrotated page.
26+
27+
So the returned value of e.g. :meth:`Page.getImageBbox` will not change if you do a :meth:`Page.setRotation`. The same is true for coordinates returned by :meth:`Page.getText`, annotation rectangles, and so on. If you want to find out, where an object is located in **rotated coordinates**, multiply the coordinates with :attr:`Page.rotationMatrix`. There also is its inverse, :attr:`Page.derotationMatrix`, which you can use when interfacing with other readers, which may behave differently in this respect.
2728

2829
================================= =======================================================
2930
**Method / Attribute** **Short Description**

docs/shape.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Several draw methods can be executed in a row and each one of them will contribu
302302

303303
Finish a set of *draw*()* methods by applying :ref:`CommonParms` to all of them. This method also supports morphing the resulting compound drawing using a fixpoint :ref:`Point`.
304304

305-
:arg sequence morph: morph the text or the compound drawing around some arbitrary :ref:`Point` *fixpoint* by applying :ref:`Matrix` *matrix* to it. This implies that *fixpoint* is a **fixed point** of this operation. Default is no morphing (*None*). The matrix can contain any values in its first 4 components, *matrix.e == matrix.f == 0* must be true, however. This means that any combination of scaling, shearing, rotating, flipping, etc. is possible, but translations are not.
305+
:arg sequence morph: morph the text or the compound drawing around some arbitrary :ref:`Point` *fixpoint* by applying :ref:`Matrix` *matrix* to it. This implies that *fixpoint* is a **fixed point** of this operation: it will not change its position. Default is no morphing (*None*). The matrix can contain any values in its first 4 components, *matrix.e == matrix.f == 0* must be true, however. This means that any combination of scaling, shearing, rotating, flipping, etc. is possible, but translations are not.
306306

307307
:arg bool even_odd: request the **"even-odd rule"** for filling operations. Default is *False*, so that the **"nonzero winding number rule"** is used. These rules are alternative methods to apply the fill color where areas overlap. Only with fairly complex shapes a different behavior is to be expected with these rules. For an in-depth explanation, see :ref:`AdobeManual`, pp. 232 ff. Here is an example to demonstrate the difference.
308308

docs/textwriter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ There also exists :meth:`Page.writeText` which is able to combine one or more Te
6767
:arg page: write to this :ref:`Page`.
6868
:arg float opacity: override the value of the TextWriter for this output.
6969
:arg sequ color: override the value of the TextWriter for this output.
70-
:arg sequ morph: modify the text appearance by applying a matrix to it. If provided, this must be a sequence *(fixpoint, matrix)* with a point-like *fixpoint* and a matrix-like *matrix*. A typical example is rotating the text around *fixpoint*.
70+
:arg sequ morph: modify the text appearance by applying a matrix to it. If provided, this must be a sequence *(fixpoint, matrix)* with a point-like *fixpoint* and a matrix-like *matrix*. A typical example is rotating the text around *fixpoint*.
7171
:arg bool overlay: put in foreground (default) or background.
7272

7373

docs/vars.rst

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -256,56 +256,67 @@ Link Destination Flags
256256

257257
:rtype: bool
258258

259-
.. _AnnotationTypes:
260259

261260
Annotation Related Constants
262261
-----------------------------
263-
See chapter 8.4.5, pp. 615 of the :ref:`AdobeManual` for more details.
262+
See chapter 8.4.5, pp. 615 of the :ref:`AdobeManual` for details.
263+
264+
.. _AnnotationTypes:
264265

265-
**Annotation Types**::
266+
Annotation Types
267+
~~~~~~~~~~~~~~~~~
268+
::
266269

267270
PDF_ANNOT_TEXT 0
268271
PDF_ANNOT_LINK 1
269-
PDF_ANNOT_FREETEXT 2
272+
PDF_ANNOT_FREE_TEXT 2
270273
PDF_ANNOT_LINE 3
271274
PDF_ANNOT_SQUARE 4
272275
PDF_ANNOT_CIRCLE 5
273276
PDF_ANNOT_POLYGON 6
274-
PDF_ANNOT_POLYLINE 7
277+
PDF_ANNOT_POLY_LINE 7
275278
PDF_ANNOT_HIGHLIGHT 8
276279
PDF_ANNOT_UNDERLINE 9
277280
PDF_ANNOT_SQUIGGLY 10
278-
PDF_ANNOT_STRIKEOUT 11
281+
PDF_ANNOT_STRIKE_OUT 11
279282
PDF_ANNOT_REDACT 12
280283
PDF_ANNOT_STAMP 13
281284
PDF_ANNOT_CARET 14
282285
PDF_ANNOT_INK 15
283286
PDF_ANNOT_POPUP 16
284-
PDF_ANNOT_FILEATTACHMENT 17
287+
PDF_ANNOT_FILE_ATTACHMENT 17
285288
PDF_ANNOT_SOUND 18
286289
PDF_ANNOT_MOVIE 19
287290
PDF_ANNOT_WIDGET 20
288291
PDF_ANNOT_SCREEN 21
289-
PDF_ANNOT_PRINTERMARK 22
290-
PDF_ANNOT_TRAPNET 23
292+
PDF_ANNOT_PRINTER_MARK 22
293+
PDF_ANNOT_TRAP_NET 23
291294
PDF_ANNOT_WATERMARK 24
292295
PDF_ANNOT_3D 25
296+
PDF_ANNOT_UNKNOWN -1
293297

298+
.. _AnnotationFlags:
294299

295-
**Annotation Flag Bits**::
300+
Annotation Flag Bits
301+
~~~~~~~~~~~~~~~~~~~~~
302+
::
296303

297-
PDF_ANNOT_IS_Invisible 1 << (1-1)
298-
PDF_ANNOT_IS_Hidden 1 << (2-1)
299-
PDF_ANNOT_IS_Print 1 << (3-1)
300-
PDF_ANNOT_IS_NoZoom 1 << (4-1)
301-
PDF_ANNOT_IS_NoRotate 1 << (5-1)
302-
PDF_ANNOT_IS_NoView 1 << (6-1)
303-
PDF_ANNOT_IS_ReadOnly 1 << (7-1)
304-
PDF_ANNOT_IS_Locked 1 << (8-1)
305-
PDF_ANNOT_IS_ToggleNoView 1 << (9-1)
306-
PDF_ANNOT_IS_LockedContents 1 << (10-1)
304+
PDF_ANNOT_IS_INVISIBLE 1 << (1-1)
305+
PDF_ANNOT_IS_HIDDEN 1 << (2-1)
306+
PDF_ANNOT_IS_PRINT 1 << (3-1)
307+
PDF_ANNOT_IS_NO_ZOOM 1 << (4-1)
308+
PDF_ANNOT_IS_NO_ROTATE 1 << (5-1)
309+
PDF_ANNOT_IS_NO_VIEW 1 << (6-1)
310+
PDF_ANNOT_IS_READ_ONLY 1 << (7-1)
311+
PDF_ANNOT_IS_LOCKED 1 << (8-1)
312+
PDF_ANNOT_IS_TOGGLE_NO_VIEW 1 << (9-1)
313+
PDF_ANNOT_IS_LOCKED_CONTENTS 1 << (10-1)
307314

308-
**Annotation Line Ending Styles**::
315+
.. _AnnotationLineEnds:
316+
317+
Annotation Line Ending Styles
318+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319+
::
309320

310321
PDF_ANNOT_LE_NONE 0
311322
PDF_ANNOT_LE_SQUARE 1
@@ -322,7 +333,11 @@ See chapter 8.4.5, pp. 615 of the :ref:`AdobeManual` for more details.
322333
Widget Constants
323334
-----------------
324335

325-
**Widget types** (*field_type*)::
336+
.. _WidgetTypes:
337+
338+
Widget Types (*field_type*)
339+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340+
::
326341

327342
PDF_WIDGET_TYPE_UNKNOWN 0
328343
PDF_WIDGET_TYPE_BUTTON 1
@@ -333,7 +348,9 @@ Widget Constants
333348
PDF_WIDGET_TYPE_SIGNATURE 6
334349
PDF_WIDGET_TYPE_TEXT 7
335350

336-
**Text Widget Subtypes** (*text_format*)::
351+
Text Widget Subtypes (*text_format*)
352+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353+
::
337354

338355
PDF_WIDGET_TX_FORMAT_NONE 0
339356
PDF_WIDGET_TX_FORMAT_NUMBER 1

0 commit comments

Comments
 (0)