mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-11-16 01:21:16 +01:00
This pull request adds support for converting common eBook formats (EPUB, MOBI, AZW3, FB2, TXT, DOCX) to PDF using Calibre. It introduces a new API endpoint and updates the configuration, dependency checks, and documentation to support this feature. Additionally, it includes related UI and localization changes. **New eBook to PDF conversion feature:** * Added `ConvertEbookToPDFController` with a new `/api/v1/convert/ebook/pdf` endpoint to handle eBook to PDF conversion using Calibre, supporting options like embedding fonts, including table of contents, and page numbers. * Introduced `ConvertEbookToPdfRequest` model for handling conversion requests and options. **Configuration and dependency management:** * Updated `RuntimePathConfig`, `ApplicationProperties`, and `ExternalAppDepConfig` to support Calibre's executable path configuration and dependency checking, ensuring Calibre is available and correctly integrated. [[1]](diffhunk://#diff-68c561052c2376c3d494bf11dd821958acd9917b1b2d33a7195ca2d6df7ec517R24) [[2]](diffhunk://#diff-68c561052c2376c3d494bf11dd821958acd9917b1b2d33a7195ca2d6df7ec517R61) [[3]](diffhunk://#diff-68c561052c2376c3d494bf11dd821958acd9917b1b2d33a7195ca2d6df7ec517R72-R74) [[4]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R359) [[5]](diffhunk://#diff-8932df49d210349a062949da2ed43ce769b0f107354880a78103664f008f849eR26-R34) [[6]](diffhunk://#diff-8932df49d210349a062949da2ed43ce769b0f107354880a78103664f008f849eR48) [[7]](diffhunk://#diff-8932df49d210349a062949da2ed43ce769b0f107354880a78103664f008f849eR63-R68) [[8]](diffhunk://#diff-8932df49d210349a062949da2ed43ce769b0f107354880a78103664f008f849eR132) * Registered the new endpoint and tool group in `EndpointConfiguration`, including logic to enable/disable the feature based on Calibre's presence. [[1]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437R260) [[2]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437R440-R442) [[3]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437L487-R492) **Documentation and localization:** * Updated the `README.md` to mention eBook to PDF conversion support. * Added UI route and form for eBook to PDF conversion in the web controller. * Added English and German localization strings for the new feature, including descriptions, labels, and error messages. [[1]](diffhunk://#diff-ee1c6999a33498cfa3abba4a384e73a8b8269856899438de80560c965079a9fdR617-R620) [[2]](diffhunk://#diff-482633b22866efc985222c4a14efc5b7d2487b59f39b953f038273a39d0362f7R617-R620) [[3]](diffhunk://#diff-482633b22866efc985222c4a14efc5b7d2487b59f39b953f038273a39d0362f7R1476-R1485) ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
68 lines
2.2 KiB
Docker
68 lines
2.2 KiB
Docker
# dockerfile.dev
|
||
|
||
# Basisimage: Gradle mit JDK 17 (Debian-basiert)
|
||
FROM gradle:8.14-jdk17
|
||
|
||
# Als Root-Benutzer arbeiten, um benötigte Pakete zu installieren
|
||
USER root
|
||
|
||
# Set GRADLE_HOME und füge Gradle zum PATH hinzu
|
||
ENV GRADLE_HOME=/opt/gradle
|
||
ENV PATH="$GRADLE_HOME/bin:$PATH"
|
||
|
||
# Update und Installation zusätzlicher Pakete (Debian/Ubuntu-basiert)
|
||
RUN apt-get update && apt-get install -y \
|
||
sudo \
|
||
libreoffice \
|
||
poppler-utils \
|
||
qpdf \
|
||
# settings.yml | tessdataDir: /usr/share/tesseract-ocr/5/tessdata
|
||
tesseract-ocr \
|
||
tesseract-ocr-eng \
|
||
ffmpeg \
|
||
fonts-terminus fonts-dejavu fonts-font-awesome fonts-noto fonts-noto-core fonts-noto-cjk fonts-noto-extra fonts-liberation fonts-linuxlibertine fonts-urw-base35 \
|
||
python3-uno \
|
||
python3-venv \
|
||
# ss -tln
|
||
iproute2 \
|
||
# calibre requires these dependencies
|
||
wget \
|
||
xz-utils \
|
||
libopengl0 \
|
||
libxcb-cursor0 \
|
||
&& wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin \
|
||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
||
# Setze die Environment Variable für setuptools
|
||
ENV SETUPTOOLS_USE_DISTUTILS=local \
|
||
STIRLING_TEMPFILES_DIRECTORY=/tmp/stirling-pdf \
|
||
TMPDIR=/tmp/stirling-pdf \
|
||
TEMP=/tmp/stirling-pdf \
|
||
TMP=/tmp/stirling-pdf
|
||
|
||
# Installation der benötigten Python-Pakete
|
||
COPY .github/scripts/requirements_dev.txt /tmp/requirements_dev.txt
|
||
RUN python3 -m venv --system-site-packages /opt/venv \
|
||
&& . /opt/venv/bin/activate \
|
||
&& pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/requirements_dev.txt
|
||
|
||
# Füge den venv-Pfad zur globalen PATH-Variable hinzu, damit die Tools verfügbar sind
|
||
ENV PATH="/opt/venv/bin:$PATH"
|
||
|
||
COPY . /workspace
|
||
|
||
RUN mkdir -p /tmp/stirling-pdf \
|
||
&& fc-cache -f -v \
|
||
&& adduser --disabled-password --gecos '' devuser \
|
||
&& chown -R devuser:devuser /home/devuser /workspace /tmp/stirling-pdf
|
||
RUN echo "devuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/devuser \
|
||
&& chmod 0440 /etc/sudoers.d/devuser
|
||
|
||
# Setze das Arbeitsverzeichnis (wird später per Bind-Mount überschrieben)
|
||
WORKDIR /workspace
|
||
|
||
RUN chmod +x /workspace/.devcontainer/git-init.sh /workspace/.devcontainer/init-setup.sh
|
||
|
||
# Wechsel zum Nicht‑Root Benutzer
|
||
USER devuser
|