nupdf 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nupdf-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Luc Miaz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
nupdf-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: nupdf
3
+ Version: 1.0.0
4
+ Summary: Merge, rotate and reorder PDF/image files from a GUI or Python API
5
+ License: MIT License
6
+
7
+ Copyright (c) 2020 Luc Miaz
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Keywords: pdf,merge,rotate,pypdf
28
+ Classifier: Development Status :: 4 - Beta
29
+ Classifier: Intended Audience :: End Users/Desktop
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.9
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
37
+ Requires-Python: >=3.9
38
+ Description-Content-Type: text/markdown
39
+ License-File: LICENSE
40
+ Requires-Dist: pypdf>=4.0
41
+ Requires-Dist: Pillow>=9.0
42
+ Provides-Extra: gui
43
+ Requires-Dist: PyQt5>=5.15; extra == "gui"
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest>=7.0; extra == "dev"
46
+ Requires-Dist: pytest-cov; extra == "dev"
47
+ Requires-Dist: pylint>=3.0; extra == "dev"
48
+ Requires-Dist: pyinstaller; extra == "dev"
49
+ Provides-Extra: docs
50
+ Requires-Dist: sphinx>=7.0; extra == "docs"
51
+ Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
52
+ Requires-Dist: sphinx-autoapi>=3.0; extra == "docs"
53
+ Dynamic: license-file
54
+
55
+ # nuPDF
56
+
57
+ [![CI](https://img.shields.io/github/actions/workflow/status/youruser/nupdf/ci.yml?branch=main&label=tests)](https://github.com/youruser/nupdf/actions)
58
+ [![Python](https://img.shields.io/pypi/pyversions/nupdf)](https://pypi.org/project/nupdf/)
59
+ [![License](https://img.shields.io/github/license/youruser/nupdf)](LICENSE)
60
+ [![Docs](https://readthedocs.org/projects/nupdf/badge/?version=latest)](https://nupdf.readthedocs.io)
61
+
62
+ **nuPDF** merges, rotates and reorders PDF and image files.
63
+ It ships a clean Python API *and* an optional PyQt5 desktop GUI.
64
+
65
+ ---
66
+
67
+ ## Features
68
+
69
+ | Feature | Description |
70
+ |---|---|
71
+ | Merge | Combine any number of PDF/image files into a single PDF |
72
+ | Rotate | Rotate individual pages or entire documents |
73
+ | Recto-verso | Interleave pages for duplex scanner output |
74
+ | Bookmarks | Add PDF outline entries named after the source files |
75
+ | Image support | Auto-convert JPEG, PNG, GIF and RAW to PDF via Pillow |
76
+ | GUI | Optional PyQt5 desktop interface |
77
+ | Executables | Pre-built binaries for Windows, Ubuntu and macOS |
78
+
79
+ ---
80
+
81
+ ## Installation
82
+
83
+ ```bash
84
+ # Core library only
85
+ pip install nupdf
86
+
87
+ # With the optional GUI
88
+ pip install "nupdf[gui]"
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Quick start — Python API
94
+
95
+ ```python
96
+ from nupdf.core import read_pdf, rotate_pages, merge_pdfs
97
+
98
+ # Open a PDF (or convert an image on the fly)
99
+ reader = read_pdf("scan.jpg")
100
+ print(f"Pages: {len(reader.pages)}")
101
+
102
+ # Rotate all pages 90° clockwise
103
+ rotate_pages("input.pdf", "rotated.pdf", angle=90)
104
+
105
+ # Rotate only pages 0 and 2 (0-indexed) by 180°
106
+ rotate_pages("input.pdf", "rotated.pdf", pages=[0, 2], angle=180)
107
+
108
+ # Merge two files (with PDF bookmarks)
109
+ merge_pdfs(
110
+ ["report.pdf", "appendix.pdf"],
111
+ "combined.pdf",
112
+ recto_verso=False,
113
+ same_file=None,
114
+ bookmark=True,
115
+ )
116
+ ```
117
+
118
+ ### Recto-verso interleaving
119
+
120
+ Duplex scanners often output fronts and backs as separate files.
121
+ `merge_pdfs` can interleave them in the correct reading order:
122
+
123
+ ```python
124
+ # Fronts and backs in separate files
125
+ merge_pdfs(
126
+ ["fronts.pdf", "backs.pdf"],
127
+ "interleaved.pdf",
128
+ recto_verso=True,
129
+ same_file=True,
130
+ )
131
+
132
+ # All pages in one file (fronts in first half, backs in second half)
133
+ merge_pdfs(
134
+ ["both_sides.pdf"],
135
+ "interleaved.pdf",
136
+ recto_verso=True,
137
+ same_file=None,
138
+ )
139
+ ```
140
+
141
+ ---
142
+
143
+ ## GUI
144
+
145
+ Launch the graphical interface:
146
+
147
+ ```bash
148
+ # From source
149
+ nupdf
150
+
151
+ # Or run directly
152
+ python -m nupdf.gui
153
+ ```
154
+
155
+ ```
156
+ ┌─────────────────────────────────────┐
157
+ │ nuPDF │
158
+ │ │
159
+ │ [Insert files] [Insert folder] │
160
+ │ │
161
+ │ ☑ Merge multiple files? │
162
+ │ ☑ Add bookmarks using file title? │
163
+ │ ☐ Recto verso? │
164
+ │ ☐ Fronts and backs separate? │
165
+ │ │
166
+ │ Rotation angle (°): [ 0 ] │
167
+ │ Pages to rotate: [ ] │
168
+ │ │
169
+ │ ┌───────────────────────────────┐ │
170
+ │ │ /path/to/file1.pdf │ │
171
+ │ │ /path/to/file2.pdf │ │
172
+ │ └───────────────────────────────┘ │
173
+ │ [Up] [Down] │
174
+ │ │
175
+ │ [Clear files list] │
176
+ │ [Select saving path] │
177
+ │ saving/path/output.pdf │
178
+ │ │
179
+ │ [ Start ] │
180
+ │ │
181
+ │ Status: Ready │
182
+ └─────────────────────────────────────┘
183
+ ```
184
+
185
+ ### Page-range syntax
186
+
187
+ | Input | Pages selected (1-indexed) |
188
+ |---|---|
189
+ | `3` | Page 3 |
190
+ | `1-4` | Pages 1, 2, 3, 4 |
191
+ | `1-3;5` | Pages 1, 2, 3, 5 |
192
+ | `2;4-6;9` | Pages 2, 4, 5, 6, 9 |
193
+ | *(empty)* | All pages |
194
+
195
+ ### Supported input formats
196
+
197
+ | Extension | Notes |
198
+ |---|---|
199
+ | `.pdf` | Native; no conversion needed |
200
+ | `.jpg` / `.jpeg` | Converted to PDF via Pillow |
201
+ | `.png` | Converted to PDF via Pillow |
202
+ | `.gif` | Converted to PDF via Pillow |
203
+ | `.raw` | Converted to PDF via Pillow |
204
+
205
+ ---
206
+
207
+ ## Project structure
208
+
209
+ ```
210
+ nupdf/
211
+ ├── nupdf/
212
+ │ ├── __init__.py # Public API surface
213
+ │ ├── core.py # PDF/image manipulation logic
214
+ │ └── gui.py # PyQt5 desktop interface
215
+ ├── tests/
216
+ │ ├── conftest.py # pytest fixtures
217
+ │ └── test_core.py # Unit tests for core module
218
+ ├── docs/
219
+ │ └── source/ # Sphinx documentation
220
+ ├── .github/workflows/
221
+ │ ├── ci.yml # pytest + pylint on push/PR
222
+ │ └── release.yml # PyInstaller binaries on version tag
223
+ ├── rotatepdf.py # Backward-compatibility shim
224
+ └── pyproject.toml
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Development
230
+
231
+ ```bash
232
+ git clone https://github.com/youruser/nupdf.git
233
+ cd nupdf
234
+ pip install -e ".[gui,dev]"
235
+
236
+ # Run tests
237
+ pytest
238
+
239
+ # Lint
240
+ pylint nupdf/core.py
241
+ pylint nupdf/gui.py --disable=import-error
242
+
243
+ # Build docs
244
+ cd docs && make html
245
+ ```
246
+
247
+ ### Creating a release
248
+
249
+ Tag a commit with a version number to trigger the automated release workflow:
250
+
251
+ ```bash
252
+ git tag v1.2.3
253
+ git push origin v1.2.3
254
+ ```
255
+
256
+ GitHub Actions will build standalone executables for Windows, Ubuntu and
257
+ macOS and attach them to a new GitHub Release automatically.
258
+
259
+ ---
260
+
261
+ ## License
262
+
263
+ MIT — see [LICENSE](LICENSE).
nupdf-1.0.0/README.md ADDED
@@ -0,0 +1,209 @@
1
+ # nuPDF
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/youruser/nupdf/ci.yml?branch=main&label=tests)](https://github.com/youruser/nupdf/actions)
4
+ [![Python](https://img.shields.io/pypi/pyversions/nupdf)](https://pypi.org/project/nupdf/)
5
+ [![License](https://img.shields.io/github/license/youruser/nupdf)](LICENSE)
6
+ [![Docs](https://readthedocs.org/projects/nupdf/badge/?version=latest)](https://nupdf.readthedocs.io)
7
+
8
+ **nuPDF** merges, rotates and reorders PDF and image files.
9
+ It ships a clean Python API *and* an optional PyQt5 desktop GUI.
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ | Feature | Description |
16
+ |---|---|
17
+ | Merge | Combine any number of PDF/image files into a single PDF |
18
+ | Rotate | Rotate individual pages or entire documents |
19
+ | Recto-verso | Interleave pages for duplex scanner output |
20
+ | Bookmarks | Add PDF outline entries named after the source files |
21
+ | Image support | Auto-convert JPEG, PNG, GIF and RAW to PDF via Pillow |
22
+ | GUI | Optional PyQt5 desktop interface |
23
+ | Executables | Pre-built binaries for Windows, Ubuntu and macOS |
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ # Core library only
31
+ pip install nupdf
32
+
33
+ # With the optional GUI
34
+ pip install "nupdf[gui]"
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Quick start — Python API
40
+
41
+ ```python
42
+ from nupdf.core import read_pdf, rotate_pages, merge_pdfs
43
+
44
+ # Open a PDF (or convert an image on the fly)
45
+ reader = read_pdf("scan.jpg")
46
+ print(f"Pages: {len(reader.pages)}")
47
+
48
+ # Rotate all pages 90° clockwise
49
+ rotate_pages("input.pdf", "rotated.pdf", angle=90)
50
+
51
+ # Rotate only pages 0 and 2 (0-indexed) by 180°
52
+ rotate_pages("input.pdf", "rotated.pdf", pages=[0, 2], angle=180)
53
+
54
+ # Merge two files (with PDF bookmarks)
55
+ merge_pdfs(
56
+ ["report.pdf", "appendix.pdf"],
57
+ "combined.pdf",
58
+ recto_verso=False,
59
+ same_file=None,
60
+ bookmark=True,
61
+ )
62
+ ```
63
+
64
+ ### Recto-verso interleaving
65
+
66
+ Duplex scanners often output fronts and backs as separate files.
67
+ `merge_pdfs` can interleave them in the correct reading order:
68
+
69
+ ```python
70
+ # Fronts and backs in separate files
71
+ merge_pdfs(
72
+ ["fronts.pdf", "backs.pdf"],
73
+ "interleaved.pdf",
74
+ recto_verso=True,
75
+ same_file=True,
76
+ )
77
+
78
+ # All pages in one file (fronts in first half, backs in second half)
79
+ merge_pdfs(
80
+ ["both_sides.pdf"],
81
+ "interleaved.pdf",
82
+ recto_verso=True,
83
+ same_file=None,
84
+ )
85
+ ```
86
+
87
+ ---
88
+
89
+ ## GUI
90
+
91
+ Launch the graphical interface:
92
+
93
+ ```bash
94
+ # From source
95
+ nupdf
96
+
97
+ # Or run directly
98
+ python -m nupdf.gui
99
+ ```
100
+
101
+ ```
102
+ ┌─────────────────────────────────────┐
103
+ │ nuPDF │
104
+ │ │
105
+ │ [Insert files] [Insert folder] │
106
+ │ │
107
+ │ ☑ Merge multiple files? │
108
+ │ ☑ Add bookmarks using file title? │
109
+ │ ☐ Recto verso? │
110
+ │ ☐ Fronts and backs separate? │
111
+ │ │
112
+ │ Rotation angle (°): [ 0 ] │
113
+ │ Pages to rotate: [ ] │
114
+ │ │
115
+ │ ┌───────────────────────────────┐ │
116
+ │ │ /path/to/file1.pdf │ │
117
+ │ │ /path/to/file2.pdf │ │
118
+ │ └───────────────────────────────┘ │
119
+ │ [Up] [Down] │
120
+ │ │
121
+ │ [Clear files list] │
122
+ │ [Select saving path] │
123
+ │ saving/path/output.pdf │
124
+ │ │
125
+ │ [ Start ] │
126
+ │ │
127
+ │ Status: Ready │
128
+ └─────────────────────────────────────┘
129
+ ```
130
+
131
+ ### Page-range syntax
132
+
133
+ | Input | Pages selected (1-indexed) |
134
+ |---|---|
135
+ | `3` | Page 3 |
136
+ | `1-4` | Pages 1, 2, 3, 4 |
137
+ | `1-3;5` | Pages 1, 2, 3, 5 |
138
+ | `2;4-6;9` | Pages 2, 4, 5, 6, 9 |
139
+ | *(empty)* | All pages |
140
+
141
+ ### Supported input formats
142
+
143
+ | Extension | Notes |
144
+ |---|---|
145
+ | `.pdf` | Native; no conversion needed |
146
+ | `.jpg` / `.jpeg` | Converted to PDF via Pillow |
147
+ | `.png` | Converted to PDF via Pillow |
148
+ | `.gif` | Converted to PDF via Pillow |
149
+ | `.raw` | Converted to PDF via Pillow |
150
+
151
+ ---
152
+
153
+ ## Project structure
154
+
155
+ ```
156
+ nupdf/
157
+ ├── nupdf/
158
+ │ ├── __init__.py # Public API surface
159
+ │ ├── core.py # PDF/image manipulation logic
160
+ │ └── gui.py # PyQt5 desktop interface
161
+ ├── tests/
162
+ │ ├── conftest.py # pytest fixtures
163
+ │ └── test_core.py # Unit tests for core module
164
+ ├── docs/
165
+ │ └── source/ # Sphinx documentation
166
+ ├── .github/workflows/
167
+ │ ├── ci.yml # pytest + pylint on push/PR
168
+ │ └── release.yml # PyInstaller binaries on version tag
169
+ ├── rotatepdf.py # Backward-compatibility shim
170
+ └── pyproject.toml
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Development
176
+
177
+ ```bash
178
+ git clone https://github.com/youruser/nupdf.git
179
+ cd nupdf
180
+ pip install -e ".[gui,dev]"
181
+
182
+ # Run tests
183
+ pytest
184
+
185
+ # Lint
186
+ pylint nupdf/core.py
187
+ pylint nupdf/gui.py --disable=import-error
188
+
189
+ # Build docs
190
+ cd docs && make html
191
+ ```
192
+
193
+ ### Creating a release
194
+
195
+ Tag a commit with a version number to trigger the automated release workflow:
196
+
197
+ ```bash
198
+ git tag v1.2.3
199
+ git push origin v1.2.3
200
+ ```
201
+
202
+ GitHub Actions will build standalone executables for Windows, Ubuntu and
203
+ macOS and attach them to a new GitHub Release automatically.
204
+
205
+ ---
206
+
207
+ ## License
208
+
209
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,13 @@
1
+ """nuPDF — PDF and image manipulation library and GUI.
2
+
3
+ Typical usage
4
+ -------------
5
+ >>> from nupdf import merge_pdfs, rotate_pages
6
+ >>> merge_pdfs(["a.pdf", "b.pdf"], "out.pdf")
7
+ >>> rotate_pages("scan.pdf", "rotated.pdf", angle=90)
8
+ """
9
+
10
+ from nupdf.core import merge_pdfs, read_pdf, rotate_pages
11
+
12
+ __version__ = "1.0.0"
13
+ __all__ = ["merge_pdfs", "read_pdf", "rotate_pages"]