Skip to content

Commit ee66e5c

Browse files
committed
update mupdf to 1.25.x
1 parent 01baca8 commit ee66e5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1032
-222
lines changed

mupdf/docs/src/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ https://github.com/pradyunsg/furo/blob/main/LICENSE
3434
This then creates the HTML documentation within the folder "build" in the root of "docs".
3535

3636

37+
- Alternatively you can also use [Sphinx Autobuild](https://pypi.org/project/sphinx-autobuild/) and do:
38+
39+
`sphinx-autobuild src _build/html`
40+
41+
This will ensure that the documentation runs in a localhost and will also hot-reload changes.
42+
43+
3744
## Building PDF documentation
3845

3946

mupdf/docs/src/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2020
# ones.
2121
# extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.ifconfig"]
22-
extensions = []
22+
extensions = ["sphinx_copybutton"]
2323
if hasattr(os, "uname") and os.uname()[0] in ("OpenBSD", "Darwin"):
2424
# rst2pdf is not available on OpenBSD or MacOS.
2525
pass
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
.. Copyright (C) 2001-2024 Artifex Software, Inc.
2+
.. All Rights Reserved.
3+
4+
.. include:: header.rst
5+
6+
.. meta::
7+
:description: MuPDF documentation
8+
:keywords: MuPDF, pdf, epub
9+
10+
11+
.. _How_To_Guide_Coordinate_System:
12+
13+
The **MuPDF** Coordinate System
14+
=================================
15+
16+
Origin Point, Point Size and Y-Axis
17+
----------------------------------------------
18+
19+
In **PDF**, the origin (for example: `(0, 0)`) of a page is located at its **bottom-left point**. In **MuPDF**, the origin of a page is located at its **top-left point**.
20+
21+
22+
23+
.. image:: images/img-coordinate-space.png
24+
25+
26+
.. note::
27+
28+
The exact x,y coordinate space for origin may not be `0,0` and is defined by "CropBox" - thus "bottom left" is derived from what is defined there.
29+
30+
.. important::
31+
32+
The rotation of the page affects the PDF coordinate space orientation.
33+
34+
35+
Point Size
36+
~~~~~~~~~~~~~
37+
38+
39+
Coordinates are float numbers and measured in **points**, where:
40+
41+
- **The default is one point equals 1/72 inches**.
42+
- **Is defined by the "UserUnit" property**.
43+
44+
45+
Positioning objects
46+
~~~~~~~~~~~~~~~~~~~~~~~~~~
47+
48+
When working with positioning objects, we should appreciate this coordinate system.
49+
50+
For example:
51+
52+
.. code-block:: javascript
53+
54+
let rectangle = [0,0,200,200]
55+
56+
Results in:
57+
58+
.. image:: images/200x200-rect.png
59+
60+
61+
62+
.. _How_To_Guide_Coordinate_System_PDF:
63+
64+
Coordinate space and `PDFObject`
65+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66+
67+
In exception to using the **MuPDF** coordinate space, if we are dealing *directly* with `PDFObject` streams then we are using the **PDF** coordinate space.
68+
69+
Therefore if we doing something low-level like adding a content stream to a `PDFObject`, for example:
70+
71+
.. code-block:: javascript
72+
73+
var extra_contents = document.addStream("q 200 0 0 200 10 10 cm /Image1 Do Q", null)
74+
75+
Then in this case we are working in the **PDF** coordinate space with the origin Y-axis at the bottom left.
76+
77+
.. note::
78+
79+
To explain the syntax behind `"q 200 0 0 200 10 10 cm /Image1 Do Q"` this is **Adobe PDF** syntax for referencing, sizing and positioning an image and can be explained as follows:
80+
81+
.. code-block:: postscript
82+
83+
q % Save graphics state
84+
200 0 0 200 10 10 cm % Translate
85+
/Image1 Do % Paintimage
86+
Q % Restore graphics state
87+
88+
For more see `page 337 of the Adobe PDF Reference Guide <https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf>`_.
89+
90+
91+
.. include:: footer.rst
12.3 KB
Loading
97.2 KB
Loading
23.1 KB
Loading
315 KB
Loading
94 KB
Loading

mupdf/docs/src/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Welcome to :title:`MuPDF`
2525
----
2626

2727

28-
2928
.. toctree::
3029
:caption: User Guide
3130
:maxdepth: 2
3231

3332
quick-start-guide.rst
3433
using-mupdf.rst
3534
mupdf-wasm.rst
35+
coordinate-system.rst
3636

3737

3838
.. toctree::

mupdf/docs/src/mutool-clean.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The `clean` command pretty prints and rewrites the syntax of a :title:`PDF` file
108108
----
109109

110110
`[pages]`
111-
Comma separated list of page numbers and ranges. If no pages are supplied then all document pages will be considered for the output file.
111+
Comma separated list of page numbers and ranges (for example: 1,5,10-15,20-N), where the character N denotes the last page. If no pages are specified, then all pages will be included.
112112

113113

114114
.. include:: footer.rst

0 commit comments

Comments
 (0)