Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/about-feature-matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@
<td class="yes">
<br/>
<small>See:
<a style="color:black;" href="page.html#Page.insert_htmlbox">Page.insert_htmlbox</a>
<a style="color:black;" href="classes/page/inserting.html#Page.insert_htmlbox">Page.insert_htmlbox</a>
<br/>or:<br/>
<a style="color:black;" href="page.html#Page.insert_textbox ">Page.insert_textbox</a>
<a style="color:black;" href="classes/page/inserting.html#Page.insert_textbox">Page.insert_textbox</a>
<br/>or:<br/>
<a style="color:black;" href="textwriter.html">TextWriter</a>
<a style="color:black;" href="classes/textwriter.html">TextWriter</a>
<small>
</td>
<td class="no"></td>
Expand Down
2 changes: 1 addition & 1 deletion docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The following table illustrates how |PyMuPDF| compares with other typical soluti

Therefore input files are mostly in a form that's useful for text extraction.

If faithful reproduction of layout is important, then consider using :ref:`PyMuPDF Office <pymupdf-office>`.
If faithful reproduction of layout is important, then consider using :doc:`PyMuPDF Office <pymupdf-office/index>`.


----
Expand Down
2 changes: 1 addition & 1 deletion docs/chunking/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ element ``p{page}.b{box}`` ``p5.b7`` (1-based page, 0-based box)
to_dicts() schema
~~~~~~~~~~~~~~~~~

The method :meth:`ChunkedDocument.to_dicts` returns one dict per chunk; ``metadata`` carries every :doc:`../chunk-metadata` field as-is, for example:
The method :meth:`ChunkedDocument.to_dicts` returns one dict per chunk; ``metadata`` carries every :doc:`../classes/chunk-metadata` field as-is, for example:

.. code:: text

Expand Down
42 changes: 0 additions & 42 deletions docs/classes.rst

This file was deleted.

82 changes: 32 additions & 50 deletions docs/annot.rst → docs/classes/annot.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.. include:: header.rst
.. include:: ../header.rst

.. raw:: html

<script>
document.getElementById("headerSearchWidget").action = '../search.html';
</script>

.. _Annot:

Expand Down Expand Up @@ -73,13 +79,11 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: get_pixmap(matrix=pymupdf.Identity, dpi=None, colorspace=pymupdf.csRGB, alpha=False)

* Changed in v1.19.2: added support of dpi parameter.

Creates a pixmap from the annotation as it appears on the page in untransformed coordinates. The pixmap's :ref:`IRect` equals *Annot.rect.irect* (see below). **All parameters are keyword only.**

:arg matrix_like matrix: a matrix to be used for image creation. Default is :ref:`Identity`.

:arg int dpi: (new in v1.19.2) desired resolution in dots per inch. If not `None`, the matrix parameter is ignored.
:arg int dpi: desired resolution in dots per inch. If not `None`, the matrix parameter is ignored.

:arg colorspace: a colorspace to be used for image creation. Default is ``pymupdf.csRGB``.
:type colorspace: :ref:`Colorspace`
Expand Down Expand Up @@ -110,8 +114,6 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: get_text(option="text", clip=None, flags=None)

* New in 1.18.0

Retrieves the content of the annotation in a variety of formats -- much like the same method for :ref:`Page`.. This currently only delivers relevant data for annotation types 'FreeText' and 'Stamp'. Other types return an empty string (or equivalent objects).

:arg str option: the desired format - one of the following values. Please note that this method works exactly like the same-named method of :ref:`Page`.
Expand All @@ -131,8 +133,6 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: get_textbox(rect)

* New in 1.18.0

Return the annotation text. Mostly (except line breaks) equal to :meth:`Annot.get_text` with the "text" option.

:arg rect-like rect: the area to consider, defaults to :attr:`Annot.rect`.
Expand All @@ -156,16 +156,14 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: set_info(info=None, content=None, title=None, creationDate=None, modDate=None, subject=None)

* Changed in version 1.16.10

Changes annotation properties. These include dates, contents, subject and author (title). Changes for *name* and *id* will be ignored. The update happens selectively: To leave a property unchanged, set it to ``None``. To delete existing data, use an empty string.

:arg dict info: a dictionary compatible with the *info* property (see below). All entries must be strings. If this argument is not a dictionary, the other arguments are used instead -- else they are ignored.
:arg str content: *(new in v1.16.10)* see description in :attr:`info`.
:arg str title: *(new in v1.16.10)* see description in :attr:`info`.
:arg str creationDate: *(new in v1.16.10)* date of annot creation. If given, should be in PDF datetime format.
:arg str modDate: *(new in v1.16.10)* date of last modification. If given, should be in PDF datetime format.
:arg str subject: *(new in v1.16.10)* see description in :attr:`info`.
:arg str content: see description in :attr:`info`.
:arg str title: see description in :attr:`info`.
:arg str creationDate: date of annot creation. If given, should be in PDF datetime format.
:arg str modDate: date of last modification. If given, should be in PDF datetime format.
:arg str subject: see description in :attr:`info`.

.. method:: set_line_ends(start, end)

Expand Down Expand Up @@ -195,8 +193,6 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: set_irt_xref(xref)

* New in v1.19.3

Set annotation to be "In Response To" another one.

:arg int xref: The :data:`xref` of another annotation.
Expand All @@ -206,17 +202,13 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: set_open(is_open)

* New in v1.18.4

Set the annotation's Popup annotation to open or closed -- **or** the annotation itself, if its type is 'Text' ("sticky note").

:arg bool is_open: the desired open state.


.. method:: set_popup(rect)

* New in v1.18.4

Create a Popup annotation for the annotation and specify its rectangle. If the Popup already exists, only its rectangle is updated.

:arg rect_like rect: the desired rectangle.
Expand All @@ -231,12 +223,10 @@ There is a parent-child relationship between an annotation and its page. If the

Three overlapping 'Circle' annotations with each opacity set to 0.5:

.. image:: images/img-opacity.*
.. image:: ../images/img-opacity.*

.. attribute:: blendmode

* New in v1.18.4

The annotation's blend mode. See :ref:`AdobeManual`, page 324 for explanations.

:rtype: str
Expand All @@ -245,17 +235,13 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: set_blendmode(blend_mode)

* New in v1.16.14

Set the annotation's blend mode. See :ref:`AdobeManual`, page 324 for explanations. The blend mode can also be set in :meth:`Annot.update`.

:arg str blend_mode: set the blend mode. Use :meth:`Annot.update` to reflect this in the visual appearance. For predefined values see :ref:`BlendModes`. Use `PDF_BM_Normal` to **remove** a blend mode.


.. method:: set_name(name)

* New in version 1.16.0

Change the name field of any annotation type. For 'FileAttachment' and 'Text' annotations, this is the icon name, for 'Stamp' annotations the text in the stamp. The visual result (if any) depends on your PDF viewer. See also :ref:`mupdficons`.

:arg str name: the new name.
Expand Down Expand Up @@ -285,11 +271,9 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: set_border(border=None, width=-1, style=None, dashes=None, clouds=-1)

* Changed in version 1.16.9: Allow specification without using a dictionary. The direct parameters are used if *border* is not a dictionary.

* Changed in version 1.22.5: Support of the "cloudy" border effect.
* Changed in v1.22.5: Support of the "cloudy" border effect.

PDF only: Change border width, dashing, style and cloud effect. See the :attr:`Annot.border` attribute for more details.
PDF only: Change border width, dashing, style and cloud effect. See the :attr:`Annot.border` attribute for more details. You can pass a *border* dictionary or the individual parameters, which are used if *border* is not a dictionary.


:arg dict border: a dictionary as returned by the :attr:`border` property, with keys *"width"* (*float*), *"style"* (*str*), *"dashes"* (*sequence*) and *clouds* (*int*). Omitted keys will leave the resp. property unchanged. Set the border argument to `None` (the default) to use the other arguments.
Expand Down Expand Up @@ -331,8 +315,6 @@ There is a parent-child relationship between an annotation and its page. If the

.. method:: delete_responses()

* New in version 1.16.12

Delete annotations referring to this one. This includes any 'Popup' annotations and all annotations responding to it.


Expand All @@ -358,13 +340,13 @@ There is a parent-child relationship between an annotation and its page. If the
* :meth:`Annot.update_file`
* :meth:`Annot.set_info` (except any changes to *"content"*)

All arguments are optional. *(Changed in v1.16.14)* Blend mode and opacity are applicable to **all annotation types**. The other arguments are mostly special use, as described below.
All arguments are optional. Blend mode and opacity are applicable to **all annotation types**. The other arguments are mostly special use, as described below.

Color specifications may be made in the usual format used in PuMuPDF as sequences of floats ranging from 0.0 to 1.0 (including both). The sequence length must be 1, 3 or 4 (supporting GRAY, RGB and CMYK colorspaces respectively). For GRAY, just a float is also acceptable.

:arg str blend_mode: *(new in v1.16.14)* **valid for all annotation types:** change or set the annotation's blend mode. For valid values see :ref:`BlendModes`.
:arg str blend_mode: **valid for all annotation types:** change or set the annotation's blend mode. For valid values see :ref:`BlendModes`.

:arg float opacity: *(new in v1.16.14)* **valid for all annotation types:** change or set the annotation's transparency. Valid values are *0 <= opacity < 1*.
:arg float opacity: **valid for all annotation types:** change or set the annotation's transparency. Valid values are *0 <= opacity < 1*.

:arg float fontsize: change :data:`fontsize` of the text. 'FreeText' annotations only.

Expand All @@ -376,7 +358,7 @@ There is a parent-child relationship between an annotation and its page. If the

:arg sequence,float fill_color: the fill color.

: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``.
:arg bool cross_out: 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``.

:arg int rotate: new rotation value. Default (-1) means no change. Supports 'FreeText' and several other annotation types (see :meth:`Annot.set_rotation`), [#f1]_. Only choose 0, 90, 180, or 270 degrees for 'FreeText'. Otherwise any integer is acceptable.

Expand Down Expand Up @@ -413,8 +395,6 @@ There is a parent-child relationship between an annotation and its page. If the

:arg bytes|bytearray|BytesIO buffer_: the new file content. Omit to only change meta-information.

*(Changed in version 1.14.13)* *io.BytesIO* is now also supported.

:arg str filename: new filename to associate with the file.

:arg str ufilename: new unicode filename to associate with the file.
Expand Down Expand Up @@ -465,7 +445,7 @@ There is a parent-child relationship between an annotation and its page. If the

:rtype: :ref:`Rect`

* Changed in version 2.3:
* Changed in v2.3

* The returned rect is now consistent with the rect set by `set_rect()`.
* It may differ slightly from earlier versions:
Expand All @@ -475,7 +455,7 @@ There is a parent-child relationship between an annotation and its page. If the
* Some attributes are defined by quads so do not have a rect attribute (e.g. StrikeOut).
In this case we return the bounds rect.

* Also see the (new in 2.3) `bound` attribute.
* Also see the *(New in v2.3)* `bound` attribute.

.. attribute:: next

Expand All @@ -502,7 +482,7 @@ There is a parent-child relationship between an annotation and its page. If the
* *creationDate* -- creation timestamp.
* *modDate* -- last modified timestamp.
* *subject* -- subject.
* *id* -- *(new in version 1.16.10)* a unique identification of the annotation. This is taken from PDF key */NM*. Annotations added by PyMuPDF will have a unique name, which appears here.
* *id* -- a unique identification of the annotation. This is taken from PDF key */NM*. Annotations added by PyMuPDF will have a unique name, which appears here.

:rtype: dict

Expand Down Expand Up @@ -595,10 +575,12 @@ There is a parent-child relationship between an annotation and its page. If the

:rtype: dict

.. attribute:: bounds

The attribute's boundary rect.

.. attribute:: bounds

|new_in_v2_3|

The annotation's boundary rect.

:rtype: :ref:`Rect`

.. _mupdficons:
Expand All @@ -607,7 +589,7 @@ Annotation Icons in MuPDF
-------------------------
This is a list of icons referenceable by name for annotation types 'Text' and 'FileAttachment'. You can use them via the *icon* parameter when adding an annotation, or use the as argument in :meth:`Annot.set_name`. It is left to your discretion which item to choose when -- no mechanism will keep you from using e.g. the "Speaker" icon for a 'FileAttachment'.

.. image:: images/mupdf-icons.*
.. image:: ../images/mupdf-icons.*


Example
Expand Down Expand Up @@ -639,7 +621,7 @@ This is how the circle annotation looks like before and after the change (pop-up

|circle|

.. |circle| image:: images/img-circle.*
.. |circle| image:: ../images/img-circle.*


.. rubric:: Footnotes
Expand All @@ -648,4 +630,4 @@ This is how the circle annotation looks like before and after the change (pop-up

.. [#f2] Only the following annotation types support method :meth:`Annot.set_rect`: Text, FreeText, Square, Circle, Redact, Stamp, Caret, FileAttachment, Sound, and Movie.

.. include:: footer.rst
.. include:: ../footer.rst
10 changes: 8 additions & 2 deletions docs/archive-class.rst → docs/classes/archive-class.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.. include:: header.rst
.. include:: ../header.rst

.. raw:: html

<script>
document.getElementById("headerSearchWidget").action = '../search.html';
</script>

.. _Archive:

Expand Down Expand Up @@ -100,4 +106,4 @@ In PyMuPDF, archives are currently only used by :ref:`Story` objects and as an :
'path': 'mypath'}]
>>>

.. include:: footer.rst
.. include:: ../footer.rst
12 changes: 10 additions & 2 deletions docs/batch-result.rst → docs/classes/batch-result.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
.. include:: header.rst
.. include:: ../header.rst

.. raw:: html

<script>
document.getElementById("headerSearchWidget").action = '../search.html';
</script>


BatchResult
===========

|new_in_v2_0|

The :class:`BatchResult` object represents the outcome of converting a single
source document during a batch conversion run.

Expand Down Expand Up @@ -58,5 +66,5 @@ See also
- :func:`convert_batch`


.. include:: footer.rst
.. include:: ../footer.rst

12 changes: 9 additions & 3 deletions docs/chunk-metadata.rst → docs/classes/chunk-metadata.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
.. include:: header.rst
.. include:: ../header.rst

.. raw:: html

<script>
document.getElementById("headerSearchWidget").action = '../search.html';
</script>

.. _ChunkMetadata:

================
ChunkMetadata
================

* New in v2.0
|new_in_v2_0|

.. class:: ChunkMetadata

Expand Down Expand Up @@ -69,4 +75,4 @@ ChunkMetadata
Number of pages in the source document, or ``None`` when unavailable.


.. include:: footer.rst
.. include:: ../footer.rst
Loading
Loading