I am running Spire.Office for Python in Docker using python:3.9-slim-bookworm.
The below code works on Windows with and without using a license file.
When running using bookworm, it works when I do not assign a license file. When assigning the license file it fails with exit code -11.
Python Code:
log = logging.getLogger(__name__)
process = Process(target=render_doc, args=(filename, pdf_filename))
process.start()
process.join(300)
if process.exitcode != 0:
log.warning(
'Process converting "%s" to PDF exited with code %s',
filename,
process.exitcode,
)
-> Process converting "/tmp/72e54130-a315-4dbf-a119-16a5aa0decaa.doc" to PDF exited with code -11
def render_doc(filename: str, pdf_filename: str) -> None:
"""."""
document = Document()
document.LoadFromFile(filename)
document.AcceptChanges()
document.JPEGQuality = 100
document.SaveToFile(pdf_filename, DocFileFormat.PDF)
document.Close()
Dockerfile:
FROM python:3.9-slim-bookworm
ARG DEBIAN_FRONTEND=noninteractive
RUN \
echo "deb h t t p://deb.debian.org/debian bookworm contrib non-free" > /etc/apt/sources.list.d/contrib.list && \
apt-get -y update && \
apt-get -y --no-install-recommends install tk ttf-mscorefonts-installer && \
apt-get -y clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
COPY app/ /opt/app/
COPY *.py /opt/
COPY license.elic.xml /opt/
COPY requirements.txt ./
RUN pip install -r requirements.txt