Presentations & Ebooks¶
4 endpoints for converting presentations to PDF and ebooks between formats.
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/v1/convert/presentation |
Convert a presentation (PPTX/PPT/ODP) to PDF |
GET |
/v1/convert/presentation |
Stream a converted presentation from a URL source |
POST |
/v1/convert/ebook |
Convert an ebook (MOBI/AZW/AZW3/FB2/CBR/CBZ) to EPUB or PDF |
GET |
/v1/convert/ebook |
Stream a converted ebook from a URL source |
Python SDK Examples¶
PPTX to PDF (base64 upload)¶
import base64
from pathlib import Path
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
pptx_bytes = Path("slides.pptx").read_bytes()
result = cv.presentation(
from_format="pptx",
to_format="pdf",
file=base64.b64encode(pptx_bytes).decode(),
)
pdf_bytes = base64.b64decode(result["result"])
Path("slides.pdf").write_bytes(pdf_bytes)
print(f"Converted {result['metadata']['page_count']} slides")
PPTX to PDF from a URL¶
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
result = cv.presentation(
from_format="pptx",
to_format="pdf",
url="https://toolkitapi.io/decks/q3-review.pptx",
)
import base64
from pathlib import Path
Path("q3-review.pdf").write_bytes(base64.b64decode(result["result"]))
Download converted presentation directly to disk¶
presentation_file() streams the PDF bytes without base64 wrapping.
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
path = cv.presentation_file(
url="https://toolkitapi.io/decks/keynote.pptx",
from_format="pptx",
to_format="pdf",
output_path="keynote.pdf",
)
print(f"Saved to {path}")
MOBI to EPUB¶
import base64
from pathlib import Path
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
mobi_bytes = Path("book.mobi").read_bytes()
result = cv.ebook(
from_format="mobi",
to_format="epub",
file=base64.b64encode(mobi_bytes).decode(),
)
epub_bytes = base64.b64decode(result["result"])
Path("book.epub").write_bytes(epub_bytes)
AZW3 to PDF from a URL¶
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
result = cv.ebook(
from_format="azw3",
to_format="pdf",
url="https://toolkitapi.io/books/novel.azw3",
)
import base64
from pathlib import Path
Path("novel.pdf").write_bytes(base64.b64decode(result["result"]))
CBZ (comic archive) to EPUB¶
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
path = cv.ebook_file(
url="https://toolkitapi.io/comics/chapter1.cbz",
from_format="cbz",
to_format="epub",
output_path="chapter1.epub",
)
print(f"Saved to {path}")
Presentation Request Parameters¶
| Parameter | Type | Description |
|---|---|---|
from_format |
string | Source format: pptx, ppt, odp |
to_format |
string | Target format: pdf (default) |
file |
string | Base64-encoded source file |
url |
string | Public URL to fetch source file from |
Ebook Request Parameters¶
| Parameter | Type | Description |
|---|---|---|
from_format |
string | Source format: mobi, azw, azw3, fb2, cbr, cbz |
to_format |
string | Target format: epub (default) or pdf |
file |
string | Base64-encoded source file |
url |
string | Public URL to fetch source file from |
Response Fields¶
| Field | Type | Description |
|---|---|---|
result |
string | Base64-encoded converted file |
from_format |
string | Source format used |
to_format |
string | Target format used |
file_url |
string | Presigned download URL (when MinIO storage is enabled) |
metadata |
object | File stats: page_count, file_size |
Tip
Both presentation and ebook conversions accept a maximum file size of 100 MB. Use the _file() SDK variants to write the result directly to disk and avoid loading large base64 strings into memory.