A CLI tool for converting documents between formats, optimized for e-readers like Kobo, Kindle, and others.
- PDF to EPUB conversion with reader-specific optimizations
- Metadata editing for EPUB files
- EPUB extraction and compression for manual editing workflows
- Multi-format support designed for various e-reader devices
- Optimization profiles for different reader capabilities
git clone https://github.com/alde/publify.git
cd publify
go build -o publify# Convert PDF to EPUB
publify convert input.pdf -o output.epub
# Edit EPUB metadata
publify metadata book.epub --title "New Title" --author "Author Name"
# Extract EPUB for manual editing
publify extract book.epub -o extracted_folder/
# Compress folder back to EPUB
publify compress extracted_folder/ -o modified_book.epub
# Show help
publify --help
# Enable verbose output
publify --verbose convert input.pdf -o output.epubFor complex EPUB modifications that require manual editing:
# 1. Extract EPUB to a folder
publify extract book.epub -o book_folder/
# 2. Edit files manually in book_folder/
# - Modify HTML files in OEBPS/
# - Update CSS styles
# - Replace images
# - Edit metadata in content.opf
# 3. Compress back to EPUB
publify compress book_folder/ -o fixed_book.epubThe extracted folder maintains the standard EPUB structure:
book_folder/
├── mimetype
├── META-INF/
│ └── container.xml
└── OEBPS/
├── content.opf # Package metadata
├── toc.ncx # Table of contents
├── styles/ # CSS files
├── images/ # Image assets
└── text/ # HTML content files
- Input: PDF (for conversion), EPUB (for extraction/metadata editing)
- Output: EPUB
publify/
├── cmd/ # CLI commands and subcommands
├── internal/ # Internal packages
│ └── worker/ # Worker pool for concurrent processing
├── pkg/ # Public packages
│ ├── converter/ # Format conversion logic
│ ├── metadata/ # Metadata handling
│ ├── progress/ # Progress indicators
│ └── reader/ # E-reader profiles and capabilities
└── testdata/ # Test files and fixtures
- cobra - CLI framework
- go-epub - EPUB generation
- imaging - Image processing
- go-pdfium - PDF processing
- webp - WebP image support
- humanize - Human-readable formatting
- Go 1.25.0 or later
go build -o publifyThis project follows strict formatting and quality standards:
# Setup pre-commit hooks for automatic formatting
make setup-hooks
# Format code manually
make fmt
# Run static analysis
make lint
# Run all quality checks
make checkThe project includes comprehensive unit and integration tests:
# Run all tests
make test
# Run only unit tests
make test-unit
# Run only integration tests (requires test PDF files)
make test-integration
# Run tests with verbose output
make test-verbose
# Generate coverage report
make coverage
# Run specific integration test with Romeo and Juliet PDF
make test-romeoManual testing:
# Unit tests only
go test ./pkg/...
# All tests including integration
go test ./...
# Verbose output
go test -v ./pkg/converterTest files: Place PDF test files in the testdata/ directory. The integration tests will automatically detect and use available PDF files.
This project is licensed under the terms specified in the repository.
Contributions are welcome! Please feel free to submit issues and pull requests.