Skip to main content

zconvert

Python client for ZConvert — HTML decks to native, editable PowerPoint; Markdown to PDF and Word.

The client is tiny (one dependency, httpx) and talks to a ZConvert server, which does the rendering. Server, deck-authoring rules and the Node/Rust SDKs: https://github.com/YatchiYa/html-to-pptx.

pip install zconvert

Use

from zconvert import ZConvert

z = ZConvert("http://localhost:8000")     # or set ZCONVERT_URL

# The source can be a path, a string of content, or bytes.
z.html_to_pptx("deck.html", out="deck.pptx")
z.html_to_pptx(html_string, filename="deck.html", out="deck.pptx")

z.md_to_pdf("# Hello\n\nWorld", out="hello.pdf")
z.md_to_docx("report.md", title="Q4 review", out="report.docx")

out is optional — every call returns the bytes:

pptx = z.html_to_pptx("deck.html")

Start from a skeleton

deck.html documents the HTML deck rules in its own header comment; document.md shows every supported Markdown feature.

z.save_example("deck.html")          # writes ./deck.html
z.save_example("document.md", "docs/document.md")
z.examples()                         # [{name, description, convert_to}, …]

Parameters

Only what you set is sent, so the server's defaults stay authoritative.

z.html_to_pptx(
    "deck.html",
    mode="image",            # "native" (default, editable) | "image" (pixel-exact)
    embed_fonts=False,       # default True
    real_background=False,   # default True
    font_body="Inter",
    font_heading="Poppins",
    timeout_ms=60_000,       # per-slide render budget
)

z.md_to_pdf("report.md", title="Q4 review")

Styling the document

z.md_to_pdf("report.md", theme="violet")        # slate (default), graphite, blue,
                                                # violet, emerald, crimson, amber, teal
z.md_to_docx("report.md", accent="#0d9488")     # any hex colour
z.md_to_pdf("report.md", captions=False)        # drop the "Figure N" numbering

The theme recolours headings, links, list markers, table headers and the chart palette. PDF and DOCX read the same one, so the two stay in step.

convert() is the general form when you want to pass to yourself:

z.convert("report.md", to="docx", out="report.docx")

HTML converts to pptx only; Markdown converts to pdf or docx. An impossible pair raises ValueError before any request is made.

Async

from zconvert import AsyncZConvert

z = AsyncZConvert("http://localhost:8000")
pdf = await z.md_to_pdf("# Hello", filename="hello.md")

Errors

from zconvert import ZConvertError

try:
    z.html_to_pptx("deck.html")
except ZConvertError as e:
    print(e.status, e.detail)     # 422 "no slides found in input"

How a source is interpreted

You pass Treated as
Path("deck.html") a file, always
"deck.html" (exists on disk) a file
"# Title\n\nBody" (has a newline) content
"<section>x</section>" (no such file) content
b"..." content

Pass filename= with inline content: the extension picks the pipeline and the stem names the output.

Discovery

z.health()      # {"status": "ok", "version": "1.0.0"}
z.manifest()    # conversions, every parameter, defaults, limits

Test

pytest      # stubbed transport, no server needed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zconvert-1.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zconvert-1.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file zconvert-1.2.0.tar.gz.

File metadata

  • Download URL: zconvert-1.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for zconvert-1.2.0.tar.gz
Algorithm Hash digest
SHA256 bf2dd33a4b42eaeaff08394477def5b7eeb4206c24af60aafaf8dc406609dd6c
MD5 3732f8247ba01107e01b70fc89eaf008
BLAKE2b-256 1eb5c37f8db311e11b20d0c365b5793f29fa2375b4b4e9685965ad33e782e883

See more details on using hashes here.

File details

Details for the file zconvert-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: zconvert-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for zconvert-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d30864de4b59f30e023a3ad7c49b2a3f097e275aa01e653b36b6b7d204bb599b
MD5 76a835c6a7b60a2c1ae2c79318aa42d6
BLAKE2b-256 fa28f3c60e78de167c01ec6b48594b8cc5bc854e06a411d9a4d0514f35cf33f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page