pdf2image poppler

2019-11-29  本文已影响0人  方松潭

pdf2image:https://github.com/Belval/pdf2image

前提:

系统:linux(也适用windows使用docker)

依赖项:

1、poppler(https://poppler.freedesktop.org/);
2、poppler-data(同上的网址上有);
3、将中文字体放在文件夹/usr/share/fonts中(字体文件可以直接从windows电脑中复制过来,也可以从其他系统从复制)

Dockerfile配置:
# Use an official Python runtime as a parent image
FROM python:3.7

ENV LANG="C.UTF-8" 

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app

COPY app.py /app

COPY requirements.txt /app

COPY fonts/. /usr/share/fonts

# Upgrade pip
RUN pip install -U pip && pip install --trusted-host pypi.python.org -r requirements.txt

RUN cat /proc/version \
    && cd / \
    && curl -fSL "https://github.com/Kitware/CMake/releases/download/v3.16.0/cmake-3.16.0.tar.gz" -o cmake.tar.gz \
    && mkdir -p /cmake && tar -xzC /cmake --strip-components=1 -f cmake.tar.gz \
    && cd /cmake && ./configure && make -j8 && make install
RUN cd / \
    && curl -fSL "https://poppler.freedesktop.org/poppler-0.83.0.tar.xz" -o poppler.tar.xz \
    && mkdir -p /poppler && tar -xJC /poppler --strip-components=1 -f poppler.tar.xz \
    && cd /poppler && mkdir build && cd build && cmake .. && make -j8 && make install
RUN cd / \
    && curl -fSL "https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz" -o poppler-data.tar.gz \
    && mkdir -p /poppler-data && tar -xzC /poppler-data --strip-components=1 -f poppler-data.tar.gz \
    && cd /poppler-data && make -j8 && make install

RUN ldconfig

RUN chmod 777 /usr/share/fonts/truetype/* && fc-cache -fv

# Make port 5000 available to the world outside this container
EXPOSE 8000 5000
# Run app.py when the container launches
CMD python app.py
上一篇下一篇

猜你喜欢

热点阅读