python Fixes

This commit is contained in:
Anthony Stirling 2025-03-25 18:31:43 +00:00
parent c2bfca762f
commit aa56c3b186
4 changed files with 9 additions and 9 deletions

View File

@ -73,8 +73,8 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
py3-pillow@testing \ py3-pillow@testing \
py3-pdf2image@testing && \ py3-pdf2image@testing && \
python3 -m venv /opt/venv && \ python3 -m venv /opt/venv && \
pip install --upgrade pip && \ /opt/venv/bin/pip install --upgrade pip && \
pip install --no-cache-dir --upgrade unoserver weasyprint && \ /opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \
ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program /opt/venv/lib/python3.12/site-packages/LibreOffice && \ ln -s /usr/lib/libreoffice/program /opt/venv/lib/python3.12/site-packages/LibreOffice && \

View File

@ -83,8 +83,8 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
py3-pillow@testing \ py3-pillow@testing \
py3-pdf2image@testing && \ py3-pdf2image@testing && \
python3 -m venv /opt/venv && \ python3 -m venv /opt/venv && \
pip install --upgrade pip && \ /opt/venv/bin/pip install --upgrade pip && \
pip install --no-cache-dir --upgrade unoserver weasyprint && \ /opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \
ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/uno.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \ ln -s /usr/lib/libreoffice/program/unohelper.py /opt/venv/lib/python3.12/site-packages/ && \
ln -s /usr/lib/libreoffice/program /opt/venv/lib/python3.12/site-packages/LibreOffice && \ ln -s /usr/lib/libreoffice/program /opt/venv/lib/python3.12/site-packages/LibreOffice && \

View File

@ -1,7 +1,7 @@
services: services:
stirling-pdf: stirling-pdf:
container_name: Stirling-PDF-Security-Fat-with-login container_name: Stirling-PDF-Security-Fat-with-login
image: stirlingtools/stirling-pdf:latest-fat image: docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest-fat
deploy: deploy:
resources: resources:
limits: limits:

View File

@ -147,10 +147,10 @@ public class MergeController {
filesToDelete.add(tempFile); // Add temp file to the list for later deletion filesToDelete.add(tempFile); // Add temp file to the list for later deletion
mergerUtility.addSource(tempFile); // Add source file to the merger utility mergerUtility.addSource(tempFile); // Add source file to the merger utility
} }
mergedTempFile = File.createTempFile("merged-", ".pdf"); mergedTempFile = File.createTempFile("merged-", ".pdf");
mergerUtility.setDestinationFileName(mergedTempFile.getAbsolutePath()); mergerUtility.setDestinationFileName(mergedTempFile.getAbsolutePath());
mergerUtility.mergeDocuments( mergerUtility.mergeDocuments(
pdfDocumentFactory.getStreamCacheFunction(totalSize)); // Merge the documents pdfDocumentFactory.getStreamCacheFunction(totalSize)); // Merge the documents
@ -189,14 +189,14 @@ public class MergeController {
log.error("Error in merge pdf process", ex); log.error("Error in merge pdf process", ex);
throw ex; throw ex;
} finally { } finally {
if (mergedDocument != null) { if (mergedDocument != null) {
mergedDocument.close(); // Close the merged document mergedDocument.close(); // Close the merged document
} }
for (File file : filesToDelete) { for (File file : filesToDelete) {
if (file != null) { if (file != null) {
Files.deleteIfExists(file.toPath()); // Delete temporary files Files.deleteIfExists(file.toPath()); // Delete temporary files
} }
} }
if (mergedTempFile != null) { if (mergedTempFile != null) {
Files.deleteIfExists(mergedTempFile.toPath()); Files.deleteIfExists(mergedTempFile.toPath());
} }