1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-04 15:00:14 +01: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 \
unpaper \
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/* && \
mkdir /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
FROM base AS python-packages
# Install build tools and Python libraries
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libffi-dev \
libssl-dev \
zlib1g-dev \
libjpeg-dev && \
pip install --upgrade pip && \
pip install --no-cache-dir \
opencv-python-headless WeasyPrint && \
rm -rf /var/lib/apt/lists/*
libjpeg-dev
# Final stage: Copy necessary files from the previous stage
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
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 '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.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.h2.console.enabled=false
spring.jpa.hibernate.ddl-auto=update
# 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">
<title>PDF.js viewer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"
integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
crossorigin="anonymous"></script>
<!-- Bootstrap -->
<script src="js/thirdParty/popper.min.js"></script>
<script src="js/thirdParty/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- This snippet is used in production (included from view-pdf.html) -->
<link rel="resource" type="application/l10n" href="/pdfjs/locale/locale.properties">
<script src="/pdfjs/pdf.js"></script>
<link rel="resource" type="application/l10n" href="pdfjs/locale/locale.properties">
<script src="pdfjs/pdf.js"></script>
<link rel="stylesheet" href="/pdfjs/css/viewer.css">
<script src="/pdfjs/js/viewer.js"></script>
<link rel="stylesheet" href="pdfjs/css/viewer.css">
<script src="pdfjs/js/viewer.js"></script>
</head>
<body tabindex="1">