SafePDF 1.0.12__tar.gz → 1.0.14__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.
- safepdf-1.0.14/MANIFEST.in +5 -0
- {safepdf-1.0.12/SafePDF.egg-info → safepdf-1.0.14}/PKG-INFO +35 -9
- {safepdf-1.0.12 → safepdf-1.0.14}/README.md +53 -31
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/__init__.py +1 -1
- safepdf-1.0.14/SafePDF/assets/back.png +0 -0
- safepdf-1.0.14/SafePDF/assets/compress.png +0 -0
- safepdf-1.0.14/SafePDF/assets/compression_err.gif +0 -0
- safepdf-1.0.14/SafePDF/assets/crown.svg +1 -0
- safepdf-1.0.14/SafePDF/assets/extract.png +0 -0
- safepdf-1.0.14/SafePDF/assets/icon.ico +0 -0
- safepdf-1.0.14/SafePDF/assets/jpg2pdf.png +0 -0
- safepdf-1.0.14/SafePDF/assets/merge.png +0 -0
- safepdf-1.0.14/SafePDF/assets/next.png +0 -0
- safepdf-1.0.14/SafePDF/assets/pdf2jpg.png +0 -0
- safepdf-1.0.14/SafePDF/assets/pdf2ocr.png +0 -0
- safepdf-1.0.14/SafePDF/assets/pdf2txt.png +0 -0
- safepdf-1.0.14/SafePDF/assets/pdf2word.png +0 -0
- safepdf-1.0.14/SafePDF/assets/repair.png +0 -0
- safepdf-1.0.14/SafePDF/assets/rotate.png +0 -0
- safepdf-1.0.14/SafePDF/assets/split.png +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ctrl/safe_pdf_controller.py +105 -36
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf2docx.py +1 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf_compress.py +144 -22
- safepdf-1.0.14/SafePDF/ops/pdf_ocr.py +234 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf_operations.py +101 -3
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/updates.py +71 -71
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/safe_pdf_app.py +13 -3
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/test/test_compression.py +1 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/test/test_pro_dialog.py +6 -5
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/de/pro_features.txt +2 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/de/ui.json +68 -11
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/en/pro_features.txt +2 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/en/ui.json +68 -11
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/tr/pro_features.txt +2 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/tr/ui.json +68 -11
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/__init__.py +1 -1
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/common_elements.py +1 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/help_ui.py +8 -17
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/operation_settings.py +234 -70
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/safe_pdf_ui.py +749 -363
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/settings_ui.py +26 -26
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/tabs_manager.py +16 -42
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/update_ui.py +38 -38
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/version.txt +6 -6
- {safepdf-1.0.12 → safepdf-1.0.14/SafePDF.egg-info}/PKG-INFO +35 -9
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF.egg-info/SOURCES.txt +18 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF.egg-info/requires.txt +7 -2
- safepdf-1.0.14/pyproject.toml +3 -0
- safepdf-1.0.14/requirements.txt +13 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/setup.py +21 -10
- safepdf-1.0.12/MANIFEST.in +0 -1
- safepdf-1.0.12/requirements.txt +0 -27
- {safepdf-1.0.12 → safepdf-1.0.14}/LICENSE +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ctrl/__init__.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ctrl/language_manager.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/logger/__init__.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/logger/logging_config.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/__init__.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/license_manager.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf2jpeg.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf_merge.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf_rotate.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ops/pdf_split.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/test/__init__.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/de/help_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/de/welcome_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/en/help_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/en/welcome_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/tr/help_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/text/tr/welcome_content.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF/ui/language_elements.py +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF.egg-info/dependency_links.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF.egg-info/entry_points.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/SafePDF.egg-info/top_level.txt +0 -0
- {safepdf-1.0.12 → safepdf-1.0.14}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SafePDF
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.14
|
|
4
4
|
Summary: A safe PDF manipulation tool
|
|
5
5
|
Home-page: https://github.com/mcagriaksoy/safepdf
|
|
6
6
|
Author: Mehmet Cagri Aksoy
|
|
@@ -17,11 +17,14 @@ License-File: LICENSE
|
|
|
17
17
|
Requires-Dist: PyPDF2>=3.0.0
|
|
18
18
|
Requires-Dist: Pillow>=9.0.0
|
|
19
19
|
Requires-Dist: pypdfium2>=4.0.0
|
|
20
|
-
Requires-Dist: tkinterdnd2>=0.3.0
|
|
21
20
|
Requires-Dist: python-docx>=0.8.11
|
|
22
|
-
Requires-Dist: requests>=2.25.0
|
|
23
21
|
Requires-Dist: PyGitHub>=1.55.0
|
|
24
22
|
Requires-Dist: python-gnupg>=0.4.8
|
|
23
|
+
Requires-Dist: tkinterdnd2>=0.3.0
|
|
24
|
+
Provides-Extra: ocr
|
|
25
|
+
Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
|
|
26
|
+
Provides-Extra: full
|
|
27
|
+
Requires-Dist: pytesseract>=0.3.10; extra == "full"
|
|
25
28
|
Dynamic: author
|
|
26
29
|
Dynamic: author-email
|
|
27
30
|
Dynamic: classifier
|
|
@@ -29,6 +32,7 @@ Dynamic: description
|
|
|
29
32
|
Dynamic: description-content-type
|
|
30
33
|
Dynamic: home-page
|
|
31
34
|
Dynamic: license-file
|
|
35
|
+
Dynamic: provides-extra
|
|
32
36
|
Dynamic: requires-dist
|
|
33
37
|
Dynamic: requires-python
|
|
34
38
|
Dynamic: summary
|
|
@@ -77,7 +81,7 @@ Dynamic: summary
|
|
|
77
81
|
- Real-time progress tracking
|
|
78
82
|
- Multi-language UI
|
|
79
83
|
- Modern, intuitive design
|
|
80
|
-
|
|
84
|
+
|
|
81
85
|

|
|
82
86
|
|
|
83
87
|

|
|
@@ -89,25 +93,45 @@ Dynamic: summary
|
|
|
89
93
|
2. Extract the ZIP file
|
|
90
94
|
3. Run `SafePDF.exe`
|
|
91
95
|
|
|
92
|
-
### Option 2:
|
|
96
|
+
### Option 2: Install from PyPI
|
|
93
97
|
|
|
94
98
|
**Requirements:**
|
|
95
|
-
- Python 3.
|
|
99
|
+
- Python 3.8+
|
|
96
100
|
- pip
|
|
97
101
|
|
|
98
102
|
**Installation:**
|
|
103
|
+
```bash
|
|
104
|
+
# Install from PyPI
|
|
105
|
+
pip install SafePDF
|
|
106
|
+
|
|
107
|
+
# Optional extras
|
|
108
|
+
# OCR support: pip install "SafePDF[ocr]"
|
|
109
|
+
# All optional extras: pip install "SafePDF[full]"
|
|
110
|
+
|
|
111
|
+
# Run the app
|
|
112
|
+
safepdf
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Option 3: Run from Source
|
|
116
|
+
|
|
99
117
|
```bash
|
|
100
118
|
# Clone the repository
|
|
101
119
|
git clone https://github.com/mcagriaksoy/SafePDF.git
|
|
102
120
|
cd SafePDF
|
|
103
121
|
|
|
104
|
-
# Install dependencies
|
|
122
|
+
# Install core dependencies
|
|
105
123
|
pip install -r requirements.txt
|
|
106
124
|
|
|
125
|
+
# Optional extras
|
|
126
|
+
# OCR support: pip install ".[ocr]"
|
|
127
|
+
# All optional extras: pip install ".[full]"
|
|
128
|
+
|
|
107
129
|
# Run the application
|
|
108
130
|
python run_safe_pdf.py
|
|
109
131
|
```
|
|
110
132
|
|
|
133
|
+
**OCR note:** OCR uses Tesseract. Install the Python extra with `SafePDF[ocr]` and make sure the Tesseract OCR application is installed on your system as well.
|
|
134
|
+
|
|
111
135
|
## How to Use
|
|
112
136
|
|
|
113
137
|
1. **Select Operation** - Choose what you want to do (compress, split, merge, etc.)
|
|
@@ -140,9 +164,11 @@ Contributions are welcome! Please:
|
|
|
140
164
|
|
|
141
165
|
## Support
|
|
142
166
|
|
|
143
|
-
-
|
|
167
|
+
- Website: [safepdf.com](https://safepdf.com)
|
|
168
|
+
- More information is available at [safepdf.com](https://safepdf.com)
|
|
169
|
+
- Email: [info@safepdf.com](mailto:info@safepdf.com)
|
|
144
170
|
- Report Issues: [GitHub Issues](https://github.com/mcagriaksoy/SafePDF/issues)
|
|
145
|
-
- Documentation: [safepdf.
|
|
171
|
+
- Documentation: [safepdf.com](https://safepdf.com)
|
|
146
172
|
|
|
147
173
|
## License
|
|
148
174
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|

|
|
27
27
|
|
|
28
|
-
## Features
|
|
28
|
+
## Features
|
|
29
29
|
|
|
30
30
|
- **Compress** - Reduce PDF file size with quality control
|
|
31
31
|
- **Split** - Separate PDFs by pages or custom ranges
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
- **Extract Text** - Extract plain text from PDFs
|
|
38
38
|
- **Extract Info** - View PDF metadata and properties
|
|
39
39
|
|
|
40
|
-
**Interface Features:**
|
|
41
|
-
- Drag & drop file selection
|
|
42
|
-
- Real-time progress tracking
|
|
43
|
-
- Multi-language UI
|
|
44
|
-
- Modern, intuitive design
|
|
45
|
-
|
|
46
|
-

|
|
40
|
+
**Interface Features:**
|
|
41
|
+
- Drag & drop file selection
|
|
42
|
+
- Real-time progress tracking
|
|
43
|
+
- Multi-language UI
|
|
44
|
+
- Modern, intuitive design
|
|
45
|
+
|
|
46
|
+

|
|
47
47
|
|
|
48
48
|

|
|
49
49
|
|
|
@@ -54,24 +54,44 @@
|
|
|
54
54
|
2. Extract the ZIP file
|
|
55
55
|
3. Run `SafePDF.exe`
|
|
56
56
|
|
|
57
|
-
### Option 2:
|
|
58
|
-
|
|
59
|
-
**Requirements:**
|
|
60
|
-
- Python 3.
|
|
61
|
-
- pip
|
|
62
|
-
|
|
63
|
-
**Installation:**
|
|
64
|
-
```bash
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
#
|
|
70
|
-
pip install
|
|
71
|
-
|
|
72
|
-
# Run the
|
|
73
|
-
|
|
74
|
-
```
|
|
57
|
+
### Option 2: Install from PyPI
|
|
58
|
+
|
|
59
|
+
**Requirements:**
|
|
60
|
+
- Python 3.8+
|
|
61
|
+
- pip
|
|
62
|
+
|
|
63
|
+
**Installation:**
|
|
64
|
+
```bash
|
|
65
|
+
# Install from PyPI
|
|
66
|
+
pip install SafePDF
|
|
67
|
+
|
|
68
|
+
# Optional extras
|
|
69
|
+
# OCR support: pip install "SafePDF[ocr]"
|
|
70
|
+
# All optional extras: pip install "SafePDF[full]"
|
|
71
|
+
|
|
72
|
+
# Run the app
|
|
73
|
+
safepdf
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Option 3: Run from Source
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Clone the repository
|
|
80
|
+
git clone https://github.com/mcagriaksoy/SafePDF.git
|
|
81
|
+
cd SafePDF
|
|
82
|
+
|
|
83
|
+
# Install core dependencies
|
|
84
|
+
pip install -r requirements.txt
|
|
85
|
+
|
|
86
|
+
# Optional extras
|
|
87
|
+
# OCR support: pip install ".[ocr]"
|
|
88
|
+
# All optional extras: pip install ".[full]"
|
|
89
|
+
|
|
90
|
+
# Run the application
|
|
91
|
+
python run_safe_pdf.py
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**OCR note:** OCR uses Tesseract. Install the Python extra with `SafePDF[ocr]` and make sure the Tesseract OCR application is installed on your system as well.
|
|
75
95
|
|
|
76
96
|
## How to Use
|
|
77
97
|
|
|
@@ -103,11 +123,13 @@ Contributions are welcome! Please:
|
|
|
103
123
|
- Submit pull requests for improvements
|
|
104
124
|
- Follow existing code style
|
|
105
125
|
|
|
106
|
-
## Support
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
126
|
+
## Support
|
|
127
|
+
|
|
128
|
+
- Website: [safepdf.com](https://safepdf.com)
|
|
129
|
+
- More information is available at [safepdf.com](https://safepdf.com)
|
|
130
|
+
- Email: [info@safepdf.com](mailto:info@safepdf.com)
|
|
131
|
+
- Report Issues: [GitHub Issues](https://github.com/mcagriaksoy/SafePDF/issues)
|
|
132
|
+
- Documentation: [safepdf.com](https://safepdf.com)
|
|
111
133
|
|
|
112
134
|
## License
|
|
113
135
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#EAC452"><path d="M200-160v-80h560v80H200Zm0-140-51-321q-2 0-4.5.5t-4.5.5q-25 0-42.5-17.5T80-680q0-25 17.5-42.5T140-740q25 0 42.5 17.5T200-680q0 7-1.5 13t-3.5 11l125 56 125-171q-11-8-18-21t-7-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820q0 15-7 28t-18 21l125 171 125-56q-2-5-3.5-11t-1.5-13q0-25 17.5-42.5T820-740q25 0 42.5 17.5T880-680q0 25-17.5 42.5T820-620q-2 0-4.5-.5t-4.5-.5l-51 321H200Zm68-80h424l26-167-105 46-133-183-133 183-105-46 26 167Zm212 0Z"/></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -52,28 +52,39 @@ class SafePDFController:
|
|
|
52
52
|
self._load_pro_status()
|
|
53
53
|
|
|
54
54
|
# PDF operations handler
|
|
55
|
-
self.pdf_ops = PDFOperations(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
self.pdf_ops = PDFOperations(
|
|
56
|
+
progress_callback=progress_callback,
|
|
57
|
+
language_manager=language_manager,
|
|
58
|
+
status_callback=self._emit_status,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Updates handler for GitHub releases and signed keys.
|
|
62
|
+
# Never let update subsystem failures block app startup.
|
|
63
|
+
try:
|
|
64
|
+
self.updates = SafePDFUpdates()
|
|
65
|
+
except Exception as e:
|
|
66
|
+
self.logger.error(f"Failed to initialize update subsystem: {e}", exc_info=True)
|
|
67
|
+
self.updates = None
|
|
64
68
|
|
|
65
69
|
# Callbacks for UI updates
|
|
66
70
|
self.progress_callback = progress_callback
|
|
67
71
|
self.update_ui_callback = None
|
|
68
72
|
self.completion_callback = None
|
|
73
|
+
self.status_callback = None
|
|
69
74
|
|
|
70
|
-
def set_ui_callbacks(self, update_ui_callback=None, completion_callback=None):
|
|
75
|
+
def set_ui_callbacks(self, update_ui_callback=None, completion_callback=None, status_callback=None):
|
|
71
76
|
"""Set callback functions for UI updates"""
|
|
72
77
|
self.update_ui_callback = update_ui_callback
|
|
73
78
|
self.completion_callback = completion_callback
|
|
79
|
+
self.status_callback = status_callback
|
|
80
|
+
|
|
81
|
+
def _emit_status(self, message):
|
|
82
|
+
"""Send a live status update to the UI if available."""
|
|
83
|
+
if self.status_callback and message:
|
|
84
|
+
self.status_callback(message)
|
|
74
85
|
|
|
75
86
|
def select_file(self, file_path):
|
|
76
|
-
"""Select and validate
|
|
87
|
+
"""Select and validate file(s) for the active operation"""
|
|
77
88
|
if isinstance(file_path, list):
|
|
78
89
|
self.selected_files = file_path
|
|
79
90
|
else:
|
|
@@ -85,7 +96,10 @@ class SafePDFController:
|
|
|
85
96
|
for f in self.selected_files:
|
|
86
97
|
if not os_path.exists(f):
|
|
87
98
|
return False, f"File does not exist: {f}"
|
|
88
|
-
if
|
|
99
|
+
if self.selected_operation == "jpg_to_pdf":
|
|
100
|
+
if not f.lower().endswith((".jpg", ".jpeg")):
|
|
101
|
+
return False, f"Please select JPG files only. Invalid: {os_path.basename(f)}"
|
|
102
|
+
elif not f.lower().endswith(".pdf"):
|
|
89
103
|
return False, f"Please select PDF files only. Invalid: {os_path.basename(f)}"
|
|
90
104
|
|
|
91
105
|
filenames = [os_path.basename(f) for f in self.selected_files]
|
|
@@ -104,11 +118,13 @@ class SafePDFController:
|
|
|
104
118
|
"compress",
|
|
105
119
|
"split",
|
|
106
120
|
"merge",
|
|
121
|
+
"jpg_to_pdf",
|
|
107
122
|
"to_jpg",
|
|
108
123
|
"rotate",
|
|
109
124
|
"repair",
|
|
110
125
|
"to_word",
|
|
111
126
|
"to_txt",
|
|
127
|
+
"to_ocr",
|
|
112
128
|
"extract_info",
|
|
113
129
|
]
|
|
114
130
|
if operation in valid_operations:
|
|
@@ -142,16 +158,32 @@ class SafePDFController:
|
|
|
142
158
|
return custom_output_path, None
|
|
143
159
|
|
|
144
160
|
# Default paths with minimal processing
|
|
145
|
-
if self.selected_operation in [
|
|
161
|
+
if self.selected_operation in [
|
|
162
|
+
"compress",
|
|
163
|
+
"rotate",
|
|
164
|
+
"repair",
|
|
165
|
+
"to_word",
|
|
166
|
+
"to_txt",
|
|
167
|
+
"to_ocr",
|
|
168
|
+
"extract_info",
|
|
169
|
+
"merge",
|
|
170
|
+
"jpg_to_pdf",
|
|
171
|
+
]:
|
|
146
172
|
base_name = os_path.splitext(self.selected_file)[0]
|
|
147
173
|
if self.selected_operation == "to_word":
|
|
148
174
|
return f"{base_name}.docx", None
|
|
149
175
|
elif self.selected_operation == "to_txt":
|
|
150
176
|
return f"{base_name}.txt", None
|
|
177
|
+
elif self.selected_operation == "to_ocr":
|
|
178
|
+
ocr_format = self.operation_settings.get("ocr_output_format", "txt")
|
|
179
|
+
extension = ".docx" if ocr_format == "docx" else ".txt"
|
|
180
|
+
return f"{base_name}_ocr{extension}", None
|
|
151
181
|
elif self.selected_operation == "extract_info":
|
|
152
182
|
return f"{base_name}_info.txt", None
|
|
153
183
|
elif self.selected_operation == "merge":
|
|
154
184
|
return f"{base_name}_merged.pdf", None
|
|
185
|
+
elif self.selected_operation == "jpg_to_pdf":
|
|
186
|
+
return f"{base_name}.pdf", None
|
|
155
187
|
else:
|
|
156
188
|
return f"{base_name}_{self.selected_operation}.pdf", None
|
|
157
189
|
else:
|
|
@@ -202,6 +234,9 @@ class SafePDFController:
|
|
|
202
234
|
dpi = int(self.operation_settings.get("dpi", 200))
|
|
203
235
|
success, message = self.pdf_ops.pdf_to_jpg(self.selected_file, output_dir, dpi)
|
|
204
236
|
|
|
237
|
+
elif self.selected_operation == "jpg_to_pdf":
|
|
238
|
+
success, message = self.pdf_ops.jpg_to_pdf(self.selected_file, output_path)
|
|
239
|
+
|
|
205
240
|
elif self.selected_operation == "merge":
|
|
206
241
|
# Merge operation: use all selected files
|
|
207
242
|
if len(self.selected_files) < 2:
|
|
@@ -224,20 +259,54 @@ class SafePDFController:
|
|
|
224
259
|
|
|
225
260
|
elif self.selected_operation == "to_word":
|
|
226
261
|
# PDF to Word conversion
|
|
227
|
-
|
|
228
|
-
|
|
262
|
+
self._emit_status(
|
|
263
|
+
self.language_manager.get(
|
|
264
|
+
"status_to_word_running",
|
|
265
|
+
"Converting PDF text to DOCX...",
|
|
266
|
+
)
|
|
267
|
+
if self.language_manager
|
|
268
|
+
else "Converting PDF text to DOCX..."
|
|
269
|
+
)
|
|
229
270
|
success, message = self.pdf_ops.pdf_to_word(self.selected_file, output_path)
|
|
230
271
|
|
|
231
272
|
elif self.selected_operation == "to_txt":
|
|
232
273
|
# PDF to TXT conversion
|
|
233
|
-
|
|
234
|
-
|
|
274
|
+
self._emit_status(
|
|
275
|
+
self.language_manager.get(
|
|
276
|
+
"status_to_txt_running",
|
|
277
|
+
"Extracting selectable text from PDF...",
|
|
278
|
+
)
|
|
279
|
+
if self.language_manager
|
|
280
|
+
else "Extracting selectable text from PDF..."
|
|
281
|
+
)
|
|
235
282
|
success, message = self.pdf_ops.pdf_to_txt(self.selected_file, output_path)
|
|
236
283
|
|
|
284
|
+
elif self.selected_operation == "to_ocr":
|
|
285
|
+
# OCR-based PDF conversion
|
|
286
|
+
self._emit_status(
|
|
287
|
+
self.language_manager.get(
|
|
288
|
+
"status_to_ocr_running",
|
|
289
|
+
"Preparing OCR engine...",
|
|
290
|
+
)
|
|
291
|
+
if self.language_manager
|
|
292
|
+
else "Preparing OCR engine..."
|
|
293
|
+
)
|
|
294
|
+
ocr_format = self.operation_settings.get("ocr_output_format", "txt")
|
|
295
|
+
if ocr_format == "docx":
|
|
296
|
+
success, message = self.pdf_ops.pdf_ocr_to_docx(self.selected_file, output_path)
|
|
297
|
+
else:
|
|
298
|
+
success, message = self.pdf_ops.pdf_ocr_to_txt(self.selected_file, output_path)
|
|
299
|
+
|
|
237
300
|
elif self.selected_operation == "extract_info":
|
|
238
301
|
# Extract hidden information
|
|
239
|
-
|
|
240
|
-
|
|
302
|
+
self._emit_status(
|
|
303
|
+
self.language_manager.get(
|
|
304
|
+
"status_extract_info_running",
|
|
305
|
+
"Extracting PDF metadata and hidden information...",
|
|
306
|
+
)
|
|
307
|
+
if self.language_manager
|
|
308
|
+
else "Extracting PDF metadata and hidden information..."
|
|
309
|
+
)
|
|
241
310
|
success, message = self.pdf_ops.extract_hidden_info(self.selected_file, output_path)
|
|
242
311
|
|
|
243
312
|
# Store current output location
|
|
@@ -340,23 +409,23 @@ class SafePDFController:
|
|
|
340
409
|
"""Check if pro features are enabled, optionally for a specific feature"""
|
|
341
410
|
return self.is_pro_activated
|
|
342
411
|
|
|
343
|
-
def check_for_updates(self):
|
|
344
|
-
"""Check for available updates from GitHub Releases"""
|
|
345
|
-
if not self.updates:
|
|
346
|
-
return {"available": False, "error": "updates_unavailable"}
|
|
347
|
-
return self.updates.check_for_updates()
|
|
348
|
-
|
|
349
|
-
def download_update(self, download_url, signature_url):
|
|
350
|
-
"""Download and verify an update"""
|
|
351
|
-
if not self.updates:
|
|
352
|
-
return False, None, "Update subsystem unavailable."
|
|
353
|
-
return self.updates.download_and_verify(download_url, signature_url)
|
|
354
|
-
|
|
355
|
-
def get_release_info(self, version=None):
|
|
356
|
-
"""Get information about a specific release"""
|
|
357
|
-
if not self.updates:
|
|
358
|
-
return None
|
|
359
|
-
return self.updates.get_release_info(version)
|
|
412
|
+
def check_for_updates(self):
|
|
413
|
+
"""Check for available updates from GitHub Releases"""
|
|
414
|
+
if not self.updates:
|
|
415
|
+
return {"available": False, "error": "updates_unavailable"}
|
|
416
|
+
return self.updates.check_for_updates()
|
|
417
|
+
|
|
418
|
+
def download_update(self, download_url, signature_url):
|
|
419
|
+
"""Download and verify an update"""
|
|
420
|
+
if not self.updates:
|
|
421
|
+
return False, None, "Update subsystem unavailable."
|
|
422
|
+
return self.updates.download_and_verify(download_url, signature_url)
|
|
423
|
+
|
|
424
|
+
def get_release_info(self, version=None):
|
|
425
|
+
"""Get information about a specific release"""
|
|
426
|
+
if not self.updates:
|
|
427
|
+
return None
|
|
428
|
+
return self.updates.get_release_info(version)
|
|
360
429
|
|
|
361
430
|
def apply_settings(self, settings_dict):
|
|
362
431
|
"""Apply application settings"""
|
|
@@ -88,7 +88,7 @@ class PDFToWordConverter:
|
|
|
88
88
|
) if self.language_manager else "Operation cancelled"
|
|
89
89
|
|
|
90
90
|
page = reader.pages[page_num]
|
|
91
|
-
text = page.extract_text()
|
|
91
|
+
text = page.extract_text() or ""
|
|
92
92
|
|
|
93
93
|
# Add page content to document
|
|
94
94
|
doc.add_heading(f"Page {page_num + 1}", level=1)
|