toolvix 0.1.0__py3-none-any.whl

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.
toolvix/__init__.py ADDED
@@ -0,0 +1,22 @@
1
+ from .pdftools import (
2
+ pdfProtect,
3
+ pdfMerge,
4
+ pdfExtract,
5
+ pdfToword,
6
+ pdfToppt,
7
+ pptTopdf,
8
+ wordTopdf
9
+ )
10
+
11
+ from .imagetools import (
12
+ imageTopdf,
13
+ imageResize,
14
+ imageWatermark,
15
+ imageCompressor,
16
+ pdfToimage
17
+ )
18
+
19
+ from .filetools import (
20
+ fileEncrypt,
21
+ fileDecrypt
22
+ )
@@ -0,0 +1,2 @@
1
+ from .encrypt import fileEncrypt
2
+ from .decrypt import fileDecrypt
@@ -0,0 +1,36 @@
1
+ from cryptography.fernet import Fernet, InvalidToken
2
+ from pathlib import Path
3
+ import base64
4
+ import hashlib
5
+ import getpass
6
+
7
+
8
+ def fileDecrypt():
9
+ """Decrypt all .encrypted files in the current working folder."""
10
+ folder = Path.cwd()
11
+ password = getpass.getpass("Enter password: ")
12
+ key = base64.urlsafe_b64encode(hashlib.sha256(password.encode()).digest())
13
+ cipher = Fernet(key)
14
+
15
+ files = sorted(folder.glob("*.encrypted"))
16
+ if not files:
17
+ print("No encrypted files found!")
18
+ return None
19
+
20
+ output_paths = []
21
+ for file_path in files:
22
+ try:
23
+ decrypted_data = cipher.decrypt(file_path.read_bytes())
24
+ output_file = file_path.with_name(file_path.name.removesuffix(".encrypted"))
25
+ output_file.write_bytes(decrypted_data)
26
+ file_path.unlink()
27
+ output_paths.append(output_file)
28
+ except InvalidToken:
29
+ print(f"Wrong password for: {file_path.name}")
30
+
31
+ if not output_paths:
32
+ print("No files were decrypted!")
33
+ return None
34
+
35
+ print(f"{len(output_paths)} files decrypted successfully!")
36
+ return output_paths
@@ -0,0 +1,32 @@
1
+ from cryptography.fernet import Fernet
2
+ from pathlib import Path
3
+ import base64
4
+ import hashlib
5
+ import getpass
6
+
7
+
8
+ def fileEncrypt():
9
+ """Encrypt all non-.encrypted files in the current working folder."""
10
+ folder = Path.cwd()
11
+ password = getpass.getpass("Enter password: ")
12
+ key = base64.urlsafe_b64encode(hashlib.sha256(password.encode()).digest())
13
+ cipher = Fernet(key)
14
+
15
+ files = sorted(
16
+ file for file in folder.iterdir()
17
+ if file.is_file() and file.suffix != ".encrypted"
18
+ )
19
+
20
+ if not files:
21
+ print("No files found!")
22
+ return None
23
+
24
+ output_paths = []
25
+ for file_path in files:
26
+ encrypted_data = cipher.encrypt(file_path.read_bytes())
27
+ output_file = file_path.with_name(file_path.name + ".encrypted")
28
+ output_file.write_bytes(encrypted_data)
29
+ output_paths.append(output_file)
30
+
31
+ print(f"{len(output_paths)} files encrypted successfully!")
32
+ return output_paths
@@ -0,0 +1,5 @@
1
+ from .imgtopdf import imageTopdf
2
+ from .imgcompress import imageCompressor
3
+ from .imgresize import imageResize
4
+ from .imgwatermark import imageWatermark
5
+ from .pdftoimg import pdfToimage
@@ -0,0 +1,70 @@
1
+ from PIL import Image
2
+ from pathlib import Path
3
+
4
+
5
+ def imageCompressor(targetSizeMB=1):
6
+ folder = Path.cwd() # Use the folder where the program is running
7
+
8
+ output_folder = folder / "compressed images"
9
+ output_folder.mkdir(exist_ok=True)
10
+
11
+ supported_formats = {
12
+ ".jpg",
13
+ ".jpeg",
14
+ ".png",
15
+ ".webp",
16
+ ".bmp"
17
+ }
18
+
19
+ target_size = targetSizeMB * 1024 * 1024 # Convert MB to bytes
20
+
21
+ # Find all images automatically
22
+ images = sorted(
23
+ [
24
+ image
25
+ for image in folder.iterdir()
26
+ if image.suffix.lower() in supported_formats
27
+ ]
28
+ )
29
+
30
+ if not images:
31
+ print("No images found!")
32
+ return None
33
+
34
+ output_paths = []
35
+
36
+ for image_path in images:
37
+
38
+ original_image = Image.open(image_path).convert("RGB")
39
+
40
+ quality = 95
41
+
42
+ # Always save compressed output as JPG
43
+ output_path = output_folder / (
44
+ image_path.stem + ".jpg"
45
+ )
46
+
47
+ # Reduce quality until target size is reached
48
+ while quality > 10:
49
+
50
+ original_image.save(
51
+ output_path,
52
+ "JPEG",
53
+ quality=quality,
54
+ optimize=True
55
+ )
56
+
57
+ if output_path.stat().st_size <= target_size:
58
+ break
59
+
60
+ quality -= 5
61
+
62
+ original_image.close()
63
+
64
+ output_paths.append(output_path)
65
+
66
+ print(
67
+ f"{len(output_paths)} images compressed successfully!"
68
+ )
69
+
70
+ return output_paths
@@ -0,0 +1,32 @@
1
+ from PIL import Image, ImageOps
2
+ from pathlib import Path
3
+
4
+
5
+ def imageResize(width=1920, height=1080):
6
+ """Resize all supported images without cropping, preserving aspect ratio."""
7
+ folder = Path.cwd()
8
+ output_folder = folder / "resized images"
9
+ output_folder.mkdir(exist_ok=True)
10
+ supported_formats = {".jpg", ".jpeg", ".png", ".webp", ".bmp"}
11
+
12
+ if width <= 0 or height <= 0:
13
+ raise ValueError("width and height must be greater than 0")
14
+
15
+ images = sorted(image for image in folder.iterdir()
16
+ if image.is_file() and image.suffix.lower() in supported_formats)
17
+ if not images:
18
+ print("No images found!")
19
+ return None
20
+
21
+ output_paths = []
22
+ for image_path in images:
23
+ with Image.open(image_path) as original_image:
24
+ resized_image = ImageOps.contain(original_image, (width, height))
25
+ if resized_image.mode in ("RGBA", "LA") or "transparency" in resized_image.info:
26
+ resized_image.save(output_folder / image_path.name)
27
+ else:
28
+ resized_image.save(output_folder / image_path.name)
29
+ output_paths.append(output_folder / image_path.name)
30
+
31
+ print(f"{len(output_paths)} images resized successfully!")
32
+ return output_paths
@@ -0,0 +1,30 @@
1
+ from PIL import Image
2
+ from pathlib import Path
3
+
4
+
5
+ def imageTopdf(output_file="photos.pdf"):
6
+ """Combine all supported images in the current folder into one PDF."""
7
+ folder = Path.cwd()
8
+ output_folder = folder / "converted pdfs"
9
+ output_folder.mkdir(exist_ok=True)
10
+ supported_formats = {".jpg", ".jpeg", ".png", ".webp", ".bmp"}
11
+
12
+ images = sorted(image for image in folder.iterdir()
13
+ if image.is_file() and image.suffix.lower() in supported_formats)
14
+ if not images:
15
+ print("No images found!")
16
+ return None
17
+
18
+ photos = []
19
+ try:
20
+ for image_path in images:
21
+ with Image.open(image_path) as image:
22
+ photos.append(image.convert("RGB"))
23
+ output_path = output_folder / output_file
24
+ photos[0].save(output_path, save_all=True, append_images=photos[1:])
25
+ finally:
26
+ for photo in photos:
27
+ photo.close()
28
+
29
+ print(f"PDF created successfully with {len(photos)} photos!")
30
+ return output_path
@@ -0,0 +1,57 @@
1
+ from PIL import Image, ImageDraw, ImageFont
2
+ from pathlib import Path
3
+
4
+
5
+ def imageWatermark(watermarkText="PREETAM", textSize=100, transparency=45, angle=25):
6
+ """Add centered watermark text to all supported images."""
7
+ if not 0 <= transparency <= 255:
8
+ raise ValueError("transparency must be between 0 and 255")
9
+ if textSize <= 0:
10
+ raise ValueError("textSize must be greater than 0")
11
+
12
+ folder = Path.cwd()
13
+ output_folder = folder / "watermarked images"
14
+ output_folder.mkdir(exist_ok=True)
15
+ supported_formats = {".jpg", ".jpeg", ".png", ".webp", ".bmp"}
16
+ images = sorted(image for image in folder.iterdir()
17
+ if image.is_file() and image.suffix.lower() in supported_formats)
18
+ if not images:
19
+ print("No images found!")
20
+ return None
21
+
22
+ font_candidates = [
23
+ Path("C:/Windows/Fonts/arial.ttf"),
24
+ Path("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"),
25
+ Path("/usr/share/fonts/truetype/liberation2/LiberationSans-Regular.ttf"),
26
+ ]
27
+ font_path = next((p for p in font_candidates if p.exists()), None)
28
+ if font_path is None:
29
+ raise FileNotFoundError("No suitable TrueType font found for watermark text")
30
+ font = ImageFont.truetype(str(font_path), textSize)
31
+
32
+ output_paths = []
33
+ for image_path in images:
34
+ with Image.open(image_path) as source:
35
+ original_image = source.convert("RGBA")
36
+ width, height = original_image.size
37
+ temp = Image.new("RGBA", (1, 1))
38
+ bbox = ImageDraw.Draw(temp).textbbox((0, 0), watermarkText, font=font)
39
+ text_width, text_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
40
+ text_layer = Image.new("RGBA", (text_width + 40, text_height + 40), (255, 255, 255, 0))
41
+ ImageDraw.Draw(text_layer).text((20, 20), watermarkText, font=font, fill=(0, 0, 0, transparency))
42
+ text_layer = text_layer.rotate(angle, expand=True, resample=Image.Resampling.BICUBIC)
43
+ x = (width - text_layer.width) // 2
44
+ y = (height - text_layer.height) // 2
45
+ original_image.alpha_composite(text_layer, (x, y))
46
+ output_path = output_folder / image_path.name
47
+ if image_path.suffix.lower() in {".jpg", ".jpeg"}:
48
+ original_image.convert("RGB").save(output_path, quality=95)
49
+ else:
50
+ original_image.save(output_path)
51
+ output_paths.append(output_path)
52
+ text_layer.close()
53
+ temp.close()
54
+ original_image.close()
55
+
56
+ print(f"{len(output_paths)} images watermarked successfully!")
57
+ return output_paths
@@ -0,0 +1,27 @@
1
+ import pymupdf
2
+ from pathlib import Path
3
+
4
+
5
+ def pdfToimage():
6
+ """Convert every PDF in the current folder into page PNG images."""
7
+ folder = Path.cwd()
8
+ output_folder = folder / "converted images"
9
+ output_folder.mkdir(exist_ok=True)
10
+ pdf_files = sorted(pdf for pdf in folder.iterdir()
11
+ if pdf.is_file() and pdf.suffix.lower() == ".pdf")
12
+ if not pdf_files:
13
+ print("No PDF files found!")
14
+ return None
15
+
16
+ output_paths = []
17
+ for pdf_path in pdf_files:
18
+ pdf_output_folder = output_folder / pdf_path.stem
19
+ pdf_output_folder.mkdir(exist_ok=True)
20
+ with pymupdf.open(pdf_path) as pdf_document:
21
+ for page_number, page in enumerate(pdf_document, start=1):
22
+ output_path = pdf_output_folder / f"{pdf_path.stem}_page_{page_number}.png"
23
+ page.get_pixmap().save(output_path)
24
+ output_paths.append(output_path)
25
+
26
+ print(f"{len(output_paths)} images created successfully!")
27
+ return output_paths
@@ -0,0 +1,7 @@
1
+ from .protect import pdfProtect
2
+ from .merge import pdfMerge
3
+ from .extract import pdfExtract
4
+ from .pdftoppt import pdfToppt
5
+ from .pdftoword import pdfToword
6
+ from .wordtopdf import wordTopdf
7
+ from .ppttopdf import pptTopdf
@@ -0,0 +1,39 @@
1
+ from pypdf import PdfReader, PdfWriter
2
+ from pathlib import Path
3
+
4
+
5
+ def pdfExtract(pages, output_file="extracted.pdf"):
6
+ folder = Path.cwd() # Use the folder where the program is running
7
+
8
+ output_folder = folder / "extracted pdfs"
9
+ output_folder.mkdir(exist_ok=True)
10
+
11
+ # Find all PDFs automatically
12
+ pdf_files = sorted(folder.glob("*.pdf"))
13
+
14
+ if not pdf_files:
15
+ print("No PDF files found!")
16
+ return None
17
+
18
+ # Use the first PDF automatically
19
+ pdf_path = pdf_files[0]
20
+
21
+ reader = PdfReader(pdf_path)
22
+ writer = PdfWriter()
23
+
24
+ # Extract the selected pages
25
+ for page_number in pages:
26
+ writer.add_page(reader.pages[page_number - 1])
27
+
28
+ # Create the extracted PDF
29
+ output_path = output_folder / output_file
30
+
31
+ with open(output_path, "wb") as file:
32
+ writer.write(file)
33
+
34
+ print(
35
+ f"{len(pages)} pages extracted from "
36
+ f"{pdf_path.name} successfully!"
37
+ )
38
+
39
+ return output_path
@@ -0,0 +1,32 @@
1
+ from pypdf import PdfWriter
2
+ from pathlib import Path
3
+
4
+
5
+ def pdfMerge(output_file="Merged.pdf"):
6
+ folder = Path.cwd() # Use the folder where the program is running
7
+
8
+ output_folder = folder / "merged pdf"
9
+ output_folder.mkdir(exist_ok=True)
10
+
11
+ # Find all PDFs in the current folder
12
+ pdf_files = sorted(folder.glob("*.pdf"))
13
+
14
+ if not pdf_files:
15
+ print("No PDF files found!")
16
+ return None
17
+
18
+ writer = PdfWriter()
19
+
20
+ # Add all PDFs to the merged file
21
+ for pdf_file in pdf_files:
22
+ writer.append(pdf_file)
23
+
24
+ # Create the output PDF
25
+ output_path = output_folder / output_file
26
+
27
+ with open(output_path, "wb") as file:
28
+ writer.write(file)
29
+
30
+ print(f"{len(pdf_files)} PDF files merged successfully!")
31
+
32
+ return output_path
@@ -0,0 +1,36 @@
1
+ from pathlib import Path
2
+ import pymupdf
3
+ from pptx import Presentation
4
+ from pptx.util import Inches
5
+
6
+
7
+ def pdfToppt(output_file=None):
8
+ """Convert all PDFs in the current folder to PowerPoint files."""
9
+ folder = Path.cwd()
10
+ output_folder = folder / "converted ppt files"
11
+ output_folder.mkdir(exist_ok=True)
12
+ pdf_files = sorted(pdf for pdf in folder.iterdir() if pdf.is_file() and pdf.suffix.lower() == ".pdf")
13
+ if not pdf_files:
14
+ print("No PDF files found!")
15
+ return None
16
+
17
+ output_paths = []
18
+ for pdf_path in pdf_files:
19
+ ppt_name = output_file if output_file and len(pdf_files) == 1 else pdf_path.stem + ".pptx"
20
+ output_path = output_folder / ppt_name
21
+ presentation = Presentation()
22
+ presentation.slide_width = Inches(13.333)
23
+ presentation.slide_height = Inches(7.5)
24
+ with pymupdf.open(pdf_path) as pdf_document:
25
+ for page_number, page in enumerate(pdf_document, start=1):
26
+ pixmap = page.get_pixmap()
27
+ temp_path = output_folder / f".toolvix_temp_page_{page_number}.png"
28
+ pixmap.save(temp_path)
29
+ slide = presentation.slides.add_slide(presentation.slide_layouts[6])
30
+ slide.shapes.add_picture(str(temp_path), 0, 0, width=presentation.slide_width, height=presentation.slide_height)
31
+ temp_path.unlink(missing_ok=True)
32
+ presentation.save(output_path)
33
+ output_paths.append(output_path)
34
+
35
+ print(f"{len(output_paths)} PowerPoint files created successfully!")
36
+ return output_paths[0] if len(output_paths) == 1 else output_paths
@@ -0,0 +1,27 @@
1
+ from pdf2docx import Converter
2
+ from pathlib import Path
3
+
4
+
5
+ def pdfToword(output_file=None):
6
+ """Convert all PDFs in the current folder to DOCX files."""
7
+ folder = Path.cwd()
8
+ output_folder = folder / "converted word files"
9
+ output_folder.mkdir(exist_ok=True)
10
+ pdf_files = sorted(pdf for pdf in folder.iterdir() if pdf.is_file() and pdf.suffix.lower() == ".pdf")
11
+ if not pdf_files:
12
+ print("No PDF files found!")
13
+ return None
14
+
15
+ output_paths = []
16
+ for pdf_path in pdf_files:
17
+ name = output_file if output_file and len(pdf_files) == 1 else pdf_path.stem + ".docx"
18
+ output_path = output_folder / name
19
+ converter = Converter(str(pdf_path))
20
+ try:
21
+ converter.convert(str(output_path))
22
+ finally:
23
+ converter.close()
24
+ output_paths.append(output_path)
25
+
26
+ print(f"{len(output_paths)} PDF files converted successfully!")
27
+ return output_paths[0] if len(output_paths) == 1 else output_paths
@@ -0,0 +1,36 @@
1
+ from pathlib import Path
2
+
3
+
4
+ def pptTopdf(output_file=None):
5
+ """Convert all PPTX files in the current folder to PDF using Microsoft PowerPoint."""
6
+ try:
7
+ import win32com.client
8
+ except ImportError as exc:
9
+ raise RuntimeError("pptTopdf requires Windows, Microsoft PowerPoint, and pywin32.") from exc
10
+
11
+ folder = Path.cwd()
12
+ output_folder = folder / "converted pdf files"
13
+ output_folder.mkdir(exist_ok=True)
14
+ ppt_files = sorted(ppt for ppt in folder.iterdir() if ppt.is_file() and ppt.suffix.lower() == ".pptx")
15
+ if not ppt_files:
16
+ print("No PowerPoint files found!")
17
+ return None
18
+
19
+ output_paths = []
20
+ powerpoint = win32com.client.Dispatch("PowerPoint.Application")
21
+ powerpoint.Visible = 0
22
+ try:
23
+ for ppt_path in ppt_files:
24
+ pdf_name = output_file if output_file and len(ppt_files) == 1 else ppt_path.stem + ".pdf"
25
+ output_path = output_folder / pdf_name
26
+ presentation = powerpoint.Presentations.Open(str(ppt_path), WithWindow=False)
27
+ try:
28
+ presentation.SaveAs(str(output_path), 32)
29
+ finally:
30
+ presentation.Close()
31
+ output_paths.append(output_path)
32
+ finally:
33
+ powerpoint.Quit()
34
+
35
+ print(f"{len(output_paths)} PowerPoint files converted successfully!")
36
+ return output_paths[0] if len(output_paths) == 1 else output_paths
@@ -0,0 +1,38 @@
1
+ from pypdf import PdfReader, PdfWriter
2
+ from pathlib import Path
3
+
4
+
5
+ def pdfProtect(output_file="protected.pdf", password="12345"):
6
+ folder = Path.cwd() # Use the folder where the program is running
7
+
8
+ output_folder = folder / "protected pdfs"
9
+ output_folder.mkdir(exist_ok=True)
10
+
11
+ # Find all PDFs automatically
12
+ pdf_files = sorted(folder.glob("*.pdf"))
13
+
14
+ if not pdf_files:
15
+ print("No PDF files found!")
16
+ return None
17
+
18
+ # Use the first PDF automatically
19
+ pdf_path = pdf_files[0]
20
+
21
+ reader = PdfReader(pdf_path)
22
+ writer = PdfWriter()
23
+
24
+ # Copy all pages
25
+ writer.append(reader)
26
+
27
+ # Protect the PDF
28
+ writer.encrypt(password)
29
+
30
+ # Create protected PDF
31
+ output_path = output_folder / output_file
32
+
33
+ with open(output_path, "wb") as file:
34
+ writer.write(file)
35
+
36
+ print("PDF protected successfully!")
37
+
38
+ return output_path
@@ -0,0 +1,36 @@
1
+ from pathlib import Path
2
+
3
+
4
+ def wordTopdf(output_file=None):
5
+ """Convert all DOCX files in the current folder to PDF using Microsoft Word."""
6
+ try:
7
+ import win32com.client
8
+ except ImportError as exc:
9
+ raise RuntimeError("wordTopdf requires Windows, Microsoft Word, and pywin32.") from exc
10
+
11
+ folder = Path.cwd()
12
+ output_folder = folder / "converted pdf files"
13
+ output_folder.mkdir(exist_ok=True)
14
+ word_files = sorted(doc for doc in folder.iterdir() if doc.is_file() and doc.suffix.lower() == ".docx")
15
+ if not word_files:
16
+ print("No Word files found!")
17
+ return None
18
+
19
+ output_paths = []
20
+ word = win32com.client.Dispatch("Word.Application")
21
+ word.Visible = False
22
+ try:
23
+ for word_path in word_files:
24
+ pdf_name = output_file if output_file and len(word_files) == 1 else word_path.stem + ".pdf"
25
+ output_path = output_folder / pdf_name
26
+ document = word.Documents.Open(str(word_path))
27
+ try:
28
+ document.SaveAs(str(output_path), FileFormat=17)
29
+ finally:
30
+ document.Close()
31
+ output_paths.append(output_path)
32
+ finally:
33
+ word.Quit()
34
+
35
+ print(f"{len(output_paths)} Word files converted successfully!")
36
+ return output_paths[0] if len(output_paths) == 1 else output_paths
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.4
2
+ Name: toolvix
3
+ Version: 0.1.0
4
+ Summary: Simple dynamic file, PDF, and image automation tools for Python
5
+ Author-email: "A.Preetam krishna" <preetam.200729@gmail.com>
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: Pillow>=10.0
9
+ Requires-Dist: pypdf>=4.0
10
+ Requires-Dist: pdf2docx>=0.5.6
11
+ Requires-Dist: PyMuPDF>=1.24
12
+ Requires-Dist: python-pptx>=0.6.23
13
+ Requires-Dist: cryptography>=42.0
14
+ Provides-Extra: windows
15
+ Requires-Dist: pywin32>=306; extra == "windows"
16
+
17
+ # Toolvix
18
+
19
+ Toolvix is a Python library for simple file, PDF, PowerPoint, Word, and image automation.
20
+ Most functions automatically discover matching files in the **current working folder**, so users do not need to pass input filenames.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install toolvix
26
+ ```
27
+
28
+ For PowerPoint/Word to PDF conversion on Windows, Microsoft PowerPoint and Microsoft Word must be installed, and install the Windows extra:
29
+
30
+ ```bash
31
+ pip install "toolvix[windows]"
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ from toolvix import *
38
+
39
+ pdfMerge("final.pdf")
40
+ pdfExtract([1, 2], "extract.pdf")
41
+ pdfProtect("protected.pdf", "12345")
42
+
43
+ imageTopdf("photos.pdf")
44
+ imageResize(1920, 1080)
45
+ imageWatermark("PREETAM")
46
+ imageCompressor(1)
47
+
48
+ fileEncrypt()
49
+ fileDecrypt()
50
+ ```
51
+
52
+ ## API
53
+
54
+ | # | Library | Package | Module | Function | Parameters | Dynamic Input | Output | Example |
55
+ |---|---|---|---|---|---|---|---|---|
56
+ | 1 | `toolvix` | `filetools` | `encrypt.py` | `fileEncrypt()` | None | All non-`.encrypted` files | Encrypted `.encrypted` files | `fileEncrypt()` |
57
+ | 2 | `toolvix` | `filetools` | `decrypt.py` | `fileDecrypt()` | None | All `.encrypted` files | Decrypted original files | `fileDecrypt()` |
58
+ | 3 | `toolvix` | `pdftools` | `merge.py` | `pdfMerge()` | `output_file` | All PDFs | One merged PDF | `pdfMerge("final.pdf")` |
59
+ | 4 | `toolvix` | `pdftools` | `extract.py` | `pdfExtract()` | `pages, output_file` | First PDF | Extracted PDF | `pdfExtract([1, 2], "extract.pdf")` |
60
+ | 5 | `toolvix` | `pdftools` | `protect.py` | `pdfProtect()` | `output_file, password` | First PDF | Protected PDF | `pdfProtect("protected.pdf", "12345")` |
61
+ | 6 | `toolvix` | `pdftools` | `pdftoword.py` | `pdfToword()` | `output_file` (optional) | All PDFs | Word file(s) | `pdfToword()` |
62
+ | 7 | `toolvix` | `pdftools` | `pdftoppt.py` | `pdfToppt()` | `output_file` (optional) | All PDFs | PowerPoint file(s) | `pdfToppt()` |
63
+ | 8 | `toolvix` | `pdftools` | `ppttopdf.py` | `pptTopdf()` | `output_file` (optional) | All PPTX files | PDF file(s) | `pptTopdf()` |
64
+ | 9 | `toolvix` | `pdftools` | `wordtopdf.py` | `wordTopdf()` | `output_file` (optional) | All DOCX files | PDF file(s) | `wordTopdf()` |
65
+ | 10 | `toolvix` | `imagetools` | `imgtopdf.py` | `imageTopdf()` | `output_file` | All supported images | One PDF | `imageTopdf("photos.pdf")` |
66
+ | 11 | `toolvix` | `imagetools` | `imgresize.py` | `imageResize()` | `width, height` | All supported images | Resized image(s) | `imageResize(1920, 1080)` |
67
+ | 12 | `toolvix` | `imagetools` | `imgwatermark.py` | `imageWatermark()` | `watermarkText, textSize, transparency, angle` | All supported images | Watermarked image(s) | `imageWatermark("PREETAM")` |
68
+ | 13 | `toolvix` | `imagetools` | `imgcompress.py` | `imageCompressor()` | `targetSizeMB` | All supported images | Compressed JPG(s) | `imageCompressor(1)` |
69
+ | 14 | `toolvix` | `imagetools` | `pdftoimg.py` | `pdfToimage()` | None | All PDFs | Page image(s) | `pdfToimage()` |
70
+
71
+ ## Parameters
72
+
73
+ ### PDF tools
74
+ - `pdfMerge(output_file="Merged.pdf")`: merges every PDF in the current folder in sorted filename order.
75
+ - `pdfExtract(pages, output_file="extracted.pdf")`: extracts selected 1-based page numbers from the first PDF.
76
+ - `pdfProtect(output_file="protected.pdf", password="12345")`: password-protects the first PDF.
77
+ - `pdfToword(output_file=None)`: converts every PDF to DOCX. With one input PDF, `output_file` can set its output name.
78
+ - `pdfToppt(output_file=None)`: converts every PDF to PPTX. With one input PDF, `output_file` can set its output name.
79
+ - `pptTopdf(output_file=None)`: converts every PPTX to PDF. With one input PPTX, `output_file` can set its output name. Windows + Microsoft PowerPoint required.
80
+ - `wordTopdf(output_file=None)`: converts every DOCX to PDF. With one input DOCX, `output_file` can set its output name. Windows + Microsoft Word required.
81
+
82
+ ### Image tools
83
+ - `imageTopdf(output_file="photos.pdf")`: combines all supported images into one PDF.
84
+ - `imageResize(width=1920, height=1080)`: resizes all supported images without cropping; aspect ratio is preserved.
85
+ - `imageWatermark(watermarkText="PREETAM", textSize=100, transparency=45, angle=25)`: adds centered watermark text. `transparency=0` is invisible and `255` is fully opaque.
86
+ - `imageCompressor(targetSizeMB=1)`: compresses all supported images to JPG, targeting approximately the requested size in MB.
87
+ - `pdfToimage()`: converts every PDF page to a PNG image.
88
+
89
+ ### File tools
90
+ - `fileEncrypt()`: asks once for a password and encrypts every non-`.encrypted` file in the current folder.
91
+ - `fileDecrypt()`: asks once for a password and decrypts every `.encrypted` file. Successfully decrypted files replace their `.encrypted` versions with the original filenames.
92
+
93
+ ## Output folders
94
+
95
+ Toolvix keeps generated files in separate folders such as `merged pdf`, `converted word files`, `resized images`, and `compressed images`.
96
+
97
+ ## Notes
98
+
99
+ - Input files are discovered from `Path.cwd()`. Run your script from the folder containing the files you want Toolvix to process.
100
+ - Do not store passwords or sensitive files in the working folder when using `fileEncrypt()`.
@@ -0,0 +1,22 @@
1
+ toolvix/__init__.py,sha256=PlYrTKxbZa8hXQnWg8RuJ3nVHkXrpVf52_8-f4MsITU,308
2
+ toolvix/filetools/__init__.py,sha256=SjpLJSPMmzhrhaNV2Lw3K54-FdvgTZdMUgt_8tnsWiI,66
3
+ toolvix/filetools/decrypt.py,sha256=U6FFrt7mklZB-2418JHpHoqL9Otw8V8nxRgJzM-L_jw,1135
4
+ toolvix/filetools/encrypt.py,sha256=CsbcI_S_2vBWqqrL0REn-eLFIOQPgR8IXUhtVBM03iw,947
5
+ toolvix/imagetools/__init__.py,sha256=lD8qycygM8Q0eL1F4YcRmpD0RuaR7qWeJOLbJCj-e7s,183
6
+ toolvix/imagetools/imgcompress.py,sha256=mf4lIhezIqxm-8weKNL4hfm-jLJcMaawPldVkksI12k,1581
7
+ toolvix/imagetools/imgresize.py,sha256=fW3VUI3mK9RxnH7DiWQlUKPT5tLWKnRS7tXwV2hU0yc,1263
8
+ toolvix/imagetools/imgtopdf.py,sha256=-Vm4jyAXow0z1r72QBSIRrjjY6bOFJdmYk18l65fOv0,1005
9
+ toolvix/imagetools/imgwatermark.py,sha256=r-scEzkZkZ7ytwy8KxyTs5RckZYxSFfmg0WezrNjMlQ,2627
10
+ toolvix/imagetools/pdftoimg.py,sha256=n0VMYqK17212RzOTGtxMAwDNsPgKUYPE_HSNI8W-JJo,1015
11
+ toolvix/pdftools/__init__.py,sha256=D-6wsIzAX4Ul0iNCWwTcVD_mWkEwAu47sA72NCZXsP4,231
12
+ toolvix/pdftools/extract.py,sha256=c0EOCqKRP8YTXKByui1oNVVxPYvLh_K6wCQ-BdILHdE,994
13
+ toolvix/pdftools/merge.py,sha256=HZUSLBvZAByAlG_M4kwHiCVW3Q-bVsN1dNRSIGv6zJk,806
14
+ toolvix/pdftools/pdftoppt.py,sha256=j1pjLaV1Fc_giAZoMK3kcZxCysM0RoK8bGb3fZTXPsQ,1617
15
+ toolvix/pdftools/pdftoword.py,sha256=wvDuRMDRAJyXpoquuH5o4rDjMV7zL-629rbR1z7Tfhc,981
16
+ toolvix/pdftools/ppttopdf.py,sha256=EJ1HHP6tEvC_G_Th3CCzF1ZnBF7Q5-X0tSk4uftt74E,1398
17
+ toolvix/pdftools/protect.py,sha256=BjGO7wmBCqvRHfMJmqQnE_XqVEax9Aa5sQRbWTeMjQU,918
18
+ toolvix/pdftools/wordtopdf.py,sha256=h63Ntaw7xH_LpXQph7Zq0YgdhE21_QBEhckVFlC7sgw,1334
19
+ toolvix-0.1.0.dist-info/METADATA,sha256=W3hy0UwN0iaYiC5yLYozTINGLDEP2BSoN1i-rLz3fA8,5706
20
+ toolvix-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
21
+ toolvix-0.1.0.dist-info/top_level.txt,sha256=vogmOy6IfKsGCgZIF8q-LJTG2z82oSyZAeadjYS-l_c,8
22
+ toolvix-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ toolvix