feat: add PDF to CBZ conversion tool with metadata support

- Updated main.ts to include 'PDF to CBZ' in the tools list.
- Added new types for CBZ options and comic metadata in pdf-to-cbz-type.ts.
- Implemented comic-info utility functions for generating ComicInfo.xml and metadata OPF files.
- Created pdf-to-cbz.html page with UI for PDF to CBZ conversion, including options for image format, quality, and metadata.
- Updated vite.config.ts to route to the new PDF to CBZ page.
This commit is contained in:
alam00000
2026-03-24 14:55:51 +05:30
parent 3ca19af354
commit e3216dddc5
30 changed files with 2004 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ Extract content from PDFs into images, documents, and data formats.
- [**PDF to WebP**](./pdf-to-webp) — Convert each PDF page into a WebP image.
- [**PDF to BMP**](./pdf-to-bmp) — Convert each PDF page into a BMP image.
- [**PDF to TIFF**](./pdf-to-tiff) — Convert each PDF page into a TIFF image.
- [**PDF to CBZ**](./pdf-to-cbz) — Convert a PDF into a CBZ (Comic Book Archive) for comic readers and Calibre.
- [**PDF to SVG**](./pdf-to-svg) — Convert each PDF page into a scalable vector graphic.
- [**PDF to CSV**](./pdf-to-csv) — Extract tables from PDF and convert to CSV format.
- [**PDF to Excel**](./pdf-to-excel) — Extract tables from PDF and convert to Excel (XLSX).

77
docs/tools/pdf-to-cbz.md Normal file
View File

@@ -0,0 +1,77 @@
---
title: PDF to CBZ
description: Convert a PDF into a CBZ (Comic Book Archive) file for comic readers like Komga, Kavita, CDisplayEx, and Calibre.
---
# PDF to CBZ
Converts a PDF into a CBZ (Comic Book ZIP) file — the standard format for digital comics and manga. Each PDF page becomes an image inside the archive. The tool generates metadata in three formats for maximum compatibility: ComicInfo.xml, metadata.opf, and ComicBookInfo JSON.
## How It Works
1. Upload a PDF by clicking the drop zone or dragging a file onto it.
2. Choose image format, quality, scale, and optional metadata.
3. Click **Convert** to generate the CBZ file.
4. The `.cbz` file downloads automatically.
## Options
| Option | Values | Default | Description |
| ---------------- | --------------- | ------- | ----------------------------------------------------------------------------- |
| Image Format | JPEG, PNG, WebP | JPEG | JPEG for color comics, PNG for lossless B&W manga, WebP for best compression. |
| Quality | 50100% | 85% | Controls JPEG/WebP compression. Hidden for PNG (always lossless). |
| Scale | 1.0x4.0x | 2.0x | Higher scale produces sharper images for high-res screens. |
| Grayscale | On/Off | Off | Converts pages to grayscale. Reduces file size for B&W content. |
| Manga mode | On/Off | Off | Sets right-to-left reading direction in metadata. |
| Include metadata | On/Off | On | Embeds ComicInfo.xml, metadata.opf, and ComicBookInfo JSON. |
## Metadata Fields
When metadata is enabled, you can fill in:
- **Title** — Auto-detected from the PDF filename.
- **Series** — The series name (e.g., "Naruto").
- **Number (#)** — Issue number within the series.
- **Volume (Vol.)** — Volume number.
- **Author(s)** — Writer or creator name.
- **Publisher** — Publishing company.
- **Tags / Genre** — Comma-separated tags (e.g., "Action, Adventure").
- **Published Year** — Year of publication (19002100).
- **Rating** — Community rating from 0 to 5.
## Metadata Compatibility
The tool writes metadata in three formats so every reader can find it:
| Format | Location | Supported by |
| ------------------ | ----------------- | ------------------------------------------- |
| ComicInfo.xml | File inside ZIP | Komga, Kavita, CDisplayEx, Mylar, ComicRack |
| metadata.opf | File inside ZIP | Calibre |
| ComicBookInfo JSON | ZIP comment field | Calibre (fallback) |
## Output Format
- `filename.cbz` — A ZIP archive containing numbered page images and metadata files.
Page images are named with zero-padded numbers (`01.jpg`, `02.jpg`, etc.) so readers display them in the correct order.
## Use Cases
- Converting manga or comic PDFs for use with comic book readers.
- Building a digital comic library in Komga, Kavita, or Calibre.
- Converting scanned comic books to a reader-friendly format.
- Sharing comics in a format that preserves reading direction and metadata.
## Tips
- Use **JPEG** for color comics and **PNG** for black-and-white manga — PNG compresses B&W content very efficiently.
- Enable **Grayscale** for manga to significantly reduce file size.
- Fill in the **Series** and **Number** fields so library managers (Komga, Calibre) can organize your collection automatically.
- **WebP** offers the best compression but older comic readers may not support it.
## Related Tools
- [PDF to JPG](./pdf-to-jpg)
- [PDF to PNG](./pdf-to-png)
- [PDF to TIFF](./pdf-to-tiff)
- [Extract Images](./extract-images)