├── .github └── workflows │ └── docker-image.yml ├── .gitmodules ├── Dockerfile └── README.rst /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | 9 | push_to_registry: 10 | name: Push Docker image to Docker Hub 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Check out the repo 15 | uses: actions/checkout@v2 16 | with: 17 | submodules: true 18 | 19 | - name: Log in to Docker Hub 20 | uses: docker/login-action@v1 21 | with: 22 | username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | password: ${{ secrets.DOCKERHUB_PASSWORD }} 24 | 25 | - name: Build and push Docker image 26 | uses: docker/build-push-action@v2 27 | with: 28 | context: . 29 | push: true 30 | tags: ilyabystrov/djvu2pdf:latest 31 | 32 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "jbig2enc"] 2 | path = jbig2enc 3 | url = https://github.com/agl/jbig2enc 4 | [submodule "ImageMagick"] 5 | path = ImageMagick 6 | url = https://github.com/ImageMagick/ImageMagick 7 | [submodule "djvu2pdf"] 8 | path = djvu2pdf 9 | url = https://github.com/vindvaki/djvu2pdf.git 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | RUN sed -i -e 's/# deb-src/deb-src/' /etc/apt/sources.list 5 | RUN apt-get update && apt-get -y upgrade 6 | RUN apt-get -y install djvulibre-bin libtiff-tools ocrodjvu 7 | 8 | # 19 | 20 | # 30 | 31 | RUN apt-get -y install ruby ruby-dev 32 | RUN gem install iconv pdfbeads 33 | 34 | # 42 | 43 | # 49 | 50 | RUN mkdir /opt/work 51 | WORKDIR /opt/work 52 | 53 | ENTRYPOINT ["djvu2pdf"] 54 | 55 | #modeline vim: set fdm=marker foldmarker= commentstring=\ #%s: 56 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ###################### 2 | Containerized DjVu2PDF 3 | ###################### 4 | 5 | A convenient way to convert files from `DjVu` to `PDF` format while preserving the text layer. 6 | 7 | The solution utilizes `djvu2pdf `_ script, which, in turn, depends on 8 | other libraries like pdfbeads, djvulibre-bin, etc. 9 | 10 | * All dependencies are packed into docker image (amd64). 11 | * Some libraries are installed from source in order to utilize specific features: JBIG2 and JPEG 2000 (JP2) 12 | compression support. 13 | * JP2 configuration in pdfbeads is modified. 14 | 15 | Run details 16 | =========== 17 | 18 | * DockerHub: https://hub.docker.com/r/ilyabystrov/djvu2pdf 19 | 20 | :: 21 | 22 | docker run --rm -u $(id -u):$(id -g) -v $(pwd):/opt/work ilyabystrov/djvu2pdf filename.djvu filename.pdf 23 | 24 | * `--rm` option - removing container after execution 25 | * `-u $(id -u):$(id -g)` - run process with the same UID and GID 26 | * -v $(pwd):/opt/work - **(required)** bind mounting of the current directory to the working directory in the 27 | container 28 | 29 | Alias 30 | ----- 31 | 32 | Put the following line into `~/.bashrc` or a similar configuration file: 33 | 34 | :: 35 | 36 | alias djvu2pdf='docker run --rm -u $(id -u):$(id -g) -v $(pwd):/opt/work ilyabystrov/djvu2pdf' 37 | 38 | It will allow using the short command 39 | 40 | :: 41 | 42 | djvu2pdf filename.djvu filename.pdf 43 | 44 | --------------------------------------------------------------------------------