Skip to content

Commit 65a4f1a

Browse files
Updated GroupDocs.Conversion to 26.5
1 parent 9e1e5a2 commit 65a4f1a

4 files changed

Lines changed: 63 additions & 6 deletions

File tree

‎Dockerfile‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@ FROM python:3.13-slim
33
# System dependencies required by the .NET runtime:
44
# - libicu-dev: ICU for .NET globalization
55
# - libgdiplus: GDI+ for System.Drawing (image conversions)
6-
# - ttf-mscorefonts-installer: Microsoft core fonts (Arial etc.) for watermarks
7-
RUN apt-get update -qq \
8-
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
9-
&& apt-get install -y --no-install-recommends libicu-dev libgdiplus ttf-mscorefonts-installer \
10-
&& rm -rf /var/lib/apt/lists/*
6+
# - fontconfig + fonts-liberation: font cache tooling plus metric-compatible
7+
# substitutes for Arial/Times/Courier
8+
# - ttf-mscorefonts-installer: the actual Microsoft core fonts (Arial etc.),
9+
# which the conversion engine looks up by name for watermarks and text
10+
# rendering. It lives in Debian "contrib" (not enabled on the slim base
11+
# image), so that component is enabled first; the debconf line pre-accepts
12+
# its EULA and wget is needed for its font download.
13+
RUN set -eux; \
14+
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
15+
sed -i 's/^Components: main$/Components: main contrib/' /etc/apt/sources.list.d/debian.sources; \
16+
else \
17+
sed -i 's/ main$/ main contrib/' /etc/apt/sources.list; \
18+
fi; \
19+
apt-get update -qq; \
20+
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections; \
21+
apt-get install -y --no-install-recommends \
22+
libicu-dev libgdiplus fontconfig fonts-liberation wget ttf-mscorefonts-installer; \
23+
fc-cache -f; \
24+
rm -rf /var/lib/apt/lists/*
1125

1226
WORKDIR /app
1327

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Drive the ``groupdocs-conversion`` command-line interface from Python.
2+
3+
Installing the ``groupdocs-conversion-net`` wheel puts a
4+
``groupdocs-conversion`` console script on ``PATH``; it is also reachable
5+
as ``python -m groupdocs.conversion``. This example shells out to it the
6+
same way a CI step, Make rule, or shell pipeline would — convert a
7+
document, inspect it, and list the target formats valid for an input.
8+
9+
See https://docs.groupdocs.com/conversion/python-net/getting-started/command-line-interface/
10+
for the full command reference.
11+
"""
12+
import subprocess
13+
import sys
14+
15+
16+
def run_cli(*args):
17+
"""Invoke the CLI via ``python -m groupdocs.conversion`` and echo it."""
18+
cmd = [sys.executable, "-m", "groupdocs.conversion", *args]
19+
print(f"$ groupdocs-conversion {' '.join(args)}")
20+
result = subprocess.run(cmd, capture_output=True, text=True)
21+
if result.stdout:
22+
print(result.stdout.rstrip())
23+
if result.returncode != 0:
24+
print(result.stderr.rstrip())
25+
raise RuntimeError(f"CLI exited with code {result.returncode}")
26+
print()
27+
return result
28+
29+
30+
def use_command_line_interface():
31+
# Convert — the target format is inferred from the output extension.
32+
run_cli("convert", "./business-plan.docx", "./business-plan.pdf")
33+
34+
# Inspect a document — prints format, size, and page count.
35+
run_cli("info", "./business-plan.pdf")
36+
37+
# List the target formats valid for a given input document.
38+
run_cli("list-formats", "./business-plan.docx")
39+
40+
41+
if __name__ == "__main__":
42+
use_command_line_interface()

‎Examples/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
groupdocs-conversion-net==26.3
1+
groupdocs-conversion-net==26.5.0
22
requests>=2.32.5

‎Examples/run_all_examples.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run_example(base_dir, example_path):
7171
"getting-started/quick-start-guide/convert_docx_to_pdf.py",
7272
"getting-started/quick-start-guide/convert_pdf_pages_to_png.py",
7373
"getting-started/quick-start-guide/convert_files_in_archive.py",
74+
"getting-started/command-line-interface/use_command_line_interface.py",
7475
"licensing/set_license_from_file.py",
7576
"licensing/set_license_from_stream.py",
7677
"licensing/set_metered_license.py",

0 commit comments

Comments
 (0)