Skip to content

Commit 5c8f094

Browse files
committed
Enhance document conversion capabilities by adding support for additional ebook formats (MOBI, AZW, AZW3, FB2) and integrating Calibre for conversions. Update README.md with installation instructions for Calibre and modify tests to cover new conversion scenarios.
1 parent dfca837 commit 5c8f094

File tree

8 files changed

+486
-49
lines changed

8 files changed

+486
-49
lines changed

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,37 @@ Terminal-based file converter built with Go. It provides a modern, user-friendly
6060

6161
### Documents
6262

63-
| Input | Output |
64-
|------------------------|---------------------------------|
65-
| `.pdf`, `.md`, `.html` | `.pdf`, `.md`, `.html`, `.epub` |
66-
| `.csv` | `.xlsx` |
67-
| `.xlsx`, `.xls` | `.csv` |
63+
| Input | Output |
64+
|-------------------------------------------|---------------------------------------------------------------------------|
65+
| `.pdf`, `.md`, `.html` | `.pdf`, `.md`, `.html`, `.epub`, `.mobi`, `.azw`, `.azw3`, `.fb2` |
66+
| `.epub`, `.mobi`, `.azw`, `.azw3`, `.fb2` | `.epub`, `.mobi`, `.azw`, `.azw3`, `.fb2`, `.pdf`, `.html`, `.txt`, `.md` |
67+
| `.csv` | `.xlsx` |
68+
| `.xlsx`, `.xls` | `.csv` |
6869

6970
**Features:**
7071

7172
- PDF text extraction to Markdown
7273
- Markdown to styled HTML with responsive design
7374
- Markdown/HTML to EPUB conversion
75+
- EPUB/MOBI/AZW/AZW3/FB2 conversions via Calibre (if installed)
7476
- PDF compression/optimization
7577
- CSV to Excel conversion with styled headers and auto-fit columns
7678
- Excel to CSV export (exports first sheet)
7779

78-
> **Note:** Video and audio conversion requires `ffmpeg` to be installed on your system.
80+
> **Note:** Video and audio conversion requires `ffmpeg`. Ebook conversions beyond EPUB require Calibre's `ebook-convert`.
81+
82+
**PATH Note (ebook-convert):**
83+
- **Linux:** Typically available at `/usr/bin/ebook-convert` (or `/snap/bin/ebook-convert`). Ensure the directory is on `PATH`.
84+
- **macOS (Homebrew):** `/opt/homebrew/bin/ebook-convert` (Apple Silicon) or `/usr/local/bin/ebook-convert` (Intel).
85+
- **Windows:** `C:\Program Files\Calibre2\ebook-convert.exe` (or `C:\Program Files (x86)\Calibre2\ebook-convert.exe`). Add the folder to `PATH` if not detected.
7986

8087
## Installation
8188

8289
### Prerequisites
8390

8491
- **Go 1.21+**
8592
- **ffmpeg** (required for video/audio conversion)
93+
- **Calibre (ebook-convert)** (required for ebook conversions beyond EPUB)
8694

8795
### Quick Install
8896

@@ -121,13 +129,13 @@ task build
121129

122130
```bash
123131
# Ubuntu/Debian
124-
sudo apt update && sudo apt install ffmpeg
132+
sudo apt update && sudo apt install ffmpeg calibre
125133

126134
# Fedora
127-
sudo dnf install ffmpeg
135+
sudo dnf install ffmpeg calibre
128136

129137
# Arch Linux
130-
sudo pacman -S ffmpeg
138+
sudo pacman -S ffmpeg calibre
131139

132140
# Build
133141
go build -o golter main.go
@@ -145,6 +153,9 @@ go build -o golter main.go
145153
# Install ffmpeg
146154
brew install ffmpeg
147155

156+
# Install Calibre (ebook-convert)
157+
brew install --cask calibre
158+
148159
# Build
149160
go build -o golter main.go
150161

@@ -161,9 +172,15 @@ go build -o golter main.go
161172
# Using winget
162173
winget install ffmpeg
163174
175+
# Calibre (ebook-convert)
176+
winget install calibre.calibre
177+
164178
# Or using chocolatey
165179
choco install ffmpeg
166180
181+
# Calibre (ebook-convert)
182+
choco install calibre
183+
167184
# Build
168185
go build -o golter.exe main.go
169186

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/go-pdf/fpdf v0.9.0
1313
github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728
1414
github.com/pdfcpu/pdfcpu v0.11.1
15+
github.com/taylorskalyo/goreader v1.0.1
1516
github.com/xuri/excelize/v2 v2.10.0
1617
github.com/yuin/goldmark v1.7.16
1718
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
100100
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
101101
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
102102
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
103+
github.com/taylorskalyo/goreader v1.0.1 h1:eS9SYiHai2aAHhm+YMGRTqrvNt2aoRMTd7p6ftm0crY=
104+
github.com/taylorskalyo/goreader v1.0.1/go.mod h1:JrUsWCgnk4C3P5Jsr7Pf2mFrMpsR0ls/0bjR5aorYTI=
103105
github.com/tiendc/go-deepcopy v1.7.1 h1:LnubftI6nYaaMOcaz0LphzwraqN8jiWTwm416sitff4=
104106
github.com/tiendc/go-deepcopy v1.7.1/go.mod h1:4bKjNC2r7boYOkD2IOuZpYjmlDdzjbpTRyCx+goBCJQ=
105107
github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50 h1:uxE3GYdXIOfhMv3unJKETJEhw78gvzuQqRX/rVirc2A=

0 commit comments

Comments
 (0)