This program converts CBZ (Comic Book Archive) files into PDF files. It uses Ghostscript to optimize the resulting PDF file size.
cbz_to_pdf Converter is script tool that simplifies the process of converting comic book archives (CBZ files) into easily shareable and readable PDF files. Ghostscript is used to ensure the PDF files are optimized for size without compromising quality.
- Python 3.x
- Ghostscript
pip install -r requirements.txt
-
Download Ghostscript:
- Visit the Ghostscript download page.
- Download the appropriate installer for Windows (64-bit or 32-bit).
-
Install Ghostscript:
- Run the downloaded installer and follow the installation instructions.
-
Add Ghostscript to the System PATH:
- Open the Start Menu, search for "Environment Variables", and select "Edit the system environment variables".
- In the System Properties window, click the "Environment Variables..." button.
- In the Environment Variables window, find the "Path" variable in the "System variables" section and select it, then click "Edit...".
- Click "New" and add the path to the Ghostscript
bin
directory (e.g.,C:\Program Files\gs\gs10.03.0\bin
). - Click "OK" to close all dialog boxes.
-
Verify the Installation:
- Open a Command Prompt and type
gswin64c -v
(orgswin32c -v
for the 32-bit version). - You should see output displaying the Ghostscript version.
- Open a Command Prompt and type
-
Create an Alias in PowerShell:
- Open a Command Prompt and type
gswin64c -v
(orgswin32c -v
for the 32-bit version). - You should see output displaying the Ghostscript version.
- Open a Command Prompt and type
Based on the output you provided, it seems that the Ghostscript path (C:\Program Files\gs\gs10.03.0\bin
) is included in your PowerShell PATH. However, the gs
command is still not recognized. Here are a few more steps to resolve this issue:
-
Navigate to the Ghostscript
bin
directory:cd "C:\Program Files\gs\gs10.03.0\bin"
-
List the files to confirm the executable name:
Get-ChildItem
1. Create an Alias in PowerShell.
If the executable is not gs.exe
, create an alias for convenience.
2. If the executable is gswin64c.exe
, create an alias in PowerShell:
Set-Alias -Name gs -Value "C:\Program Files\gs\gs10.03.0\bin\gswin64c.exe"
3. Test the alias:
gs -v
4. Add the Alias to Profile for Persistence: To make the alias persistent across PowerShell sessions, add it to your PowerShell profile.
-
Open the PowerShell profile script:
if (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force } notepad $PROFILE
-
Add the alias command to the profile:
Set-Alias -Name gs -Value "C:\Program Files\gs\gs10.03.0\bin\gswin64c.exe"
-
Save and close the file.
-
Restart PowerShell and test the
gs
command:gs -v
** 5. Verify Execution Policy** Ensure the execution policy allows for the script in the profile to run:
-
Check the current execution policy:
Get-ExecutionPolicy
-
Set the execution policy to RemoteSigned if necessary:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Update Homebrew:
brew update
-
Install Ghostscript:
brew install ghostscript
-
Verify the Installation:
gs --version
-
Update the package list:
sudo apt update
-
Install Ghostscript:
sudo apt install ghostscript
-
Verify the Installation:
gs --version
-
Update the package list:
sudo dnf check-update
-
Install Ghostscript:
sudo dnf install ghostscript
-
Verify the Installation:
gs --version
-
Update the package list (if necessary):
sudo pacman -Syu
-
Install Ghostscript:
sudo pacman -S ghostscript
-
Verify the Installation:
gs --version
python main.py
Menu
1. Add the cbz file
2. Add the cbz file and the output directory
3. reduce pdf size
4. cbz to pdf and reduce its size
5. Exit
Enter your choice: