1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-10-01 08:50:11 +02:00
This commit is contained in:
Anthony Stirling 2023-12-10 14:09:28 +00:00
parent 1e6f288d72
commit 28a9daff62
4 changed files with 54 additions and 16 deletions

View File

@ -13,6 +13,16 @@ RUN apt-get update && \
pngquant \ pngquant \
unpaper \ unpaper \
ocrmypdf && \ ocrmypdf && \
pip install --upgrade pip && \
pip install --no-cache-dir \
pillow==10.0.1 \
lxml==4.6.5 \
reportlab==3.6.13 \
setuptools==65.5.1 \
pikepdf==4.4.1 \
wheel==0.38.1 \
cryptography==39.0.1 \
opencv-python-headless && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
mkdir /usr/share/tesseract-ocr-original && \ mkdir /usr/share/tesseract-ocr-original && \
cp -r /usr/share/tesseract-ocr/* /usr/share/tesseract-ocr-original && \ cp -r /usr/share/tesseract-ocr/* /usr/share/tesseract-ocr-original && \
@ -20,18 +30,45 @@ RUN apt-get update && \
# Python packages stage # Python packages stage
FROM base AS python-packages FROM base AS python-packages
# Install build tools and Python libraries
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
build-essential \ build-essential \
libffi-dev \ libffi-dev \
libssl-dev \ libssl-dev \
zlib1g-dev \ zlib1g-dev \
libjpeg-dev && \ libjpeg-dev
pip install --upgrade pip && \
pip install --no-cache-dir \
opencv-python-headless WeasyPrint && \
rm -rf /var/lib/apt/lists/*
# Final stage: Copy necessary files from the previous stage # Final stage: Copy necessary files from the previous stage
FROM base FROM base
COPY --from=python-packages /usr/local /usr/local COPY --from=python-packages /usr/local /usr/local
# Install wkhtmltopdf
RUN apt-get update && \
apt-get install -y \
fontconfig \
libfontconfig1 \
libfreetype6 \
libx11-6 \
libxext6 \
libxrender1 \
xfonts-75dpi \
wget \
xfonts-base
# Set a default value for TARGETARCH if it's not provided
ARG TARGETARCH=arm64
# Conditional statement to choose the correct wkhtmltopdf package based on architecture
RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bullseye_amd64.deb; \
elif [ "$TARGETARCH" = "arm64" ]; then \
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bullseye_arm64.deb; \
else \
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bullseye_amd64.deb; \
fi && \
dpkg -i wkhtmltox_0.12.6.1-3.bullseye_$TARGETARCH.deb && \
rm wkhtmltox_0.12.6.1-3.bullseye_$TARGETARCH.deb && \
rm -rf /var/lib/apt/lists/*

View File

@ -80,6 +80,8 @@ dependencies {
// https://mvnrepository.com/artifact/org.apache.pdfbox/jbig2-imageio // https://mvnrepository.com/artifact/org.apache.pdfbox/jbig2-imageio
implementation group: 'org.apache.pdfbox', name: 'jbig2-imageio', version: '3.0.4' implementation group: 'org.apache.pdfbox', name: 'jbig2-imageio', version: '3.0.4'
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.3.0'
implementation 'commons-io:commons-io:2.13.0' implementation 'commons-io:commons-io:2.13.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'

View File

@ -35,7 +35,7 @@ spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB;DB_CLOSE_DELAY=-1;D
spring.datasource.driver-class-name=org.h2.Driver spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa spring.datasource.username=sa
spring.datasource.password= spring.datasource.password=
spring.h2.console.enabled=true spring.h2.console.enabled=false
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
# Change the default URL path for OpenAPI JSON # Change the default URL path for OpenAPI JSON

View File

@ -27,18 +27,17 @@ See https://github.com/adobe-type-tools/cmap-resources
<meta name="google" content="notranslate"> <meta name="google" content="notranslate">
<title>PDF.js viewer</title> <title>PDF.js viewer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" <!-- Bootstrap -->
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> <script src="js/thirdParty/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" <script src="js/thirdParty/bootstrap.min.js"></script>
integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" <link rel="stylesheet" href="css/bootstrap.min.css">
crossorigin="anonymous"></script>
<!-- This snippet is used in production (included from view-pdf.html) --> <!-- This snippet is used in production (included from view-pdf.html) -->
<link rel="resource" type="application/l10n" href="/pdfjs/locale/locale.properties"> <link rel="resource" type="application/l10n" href="pdfjs/locale/locale.properties">
<script src="/pdfjs/pdf.js"></script> <script src="pdfjs/pdf.js"></script>
<link rel="stylesheet" href="/pdfjs/css/viewer.css"> <link rel="stylesheet" href="pdfjs/css/viewer.css">
<script src="/pdfjs/js/viewer.js"></script> <script src="pdfjs/js/viewer.js"></script>
</head> </head>
<body tabindex="1"> <body tabindex="1">