Documents (PDF & DOCX)¶
Jodit's "Export" buttons send the editor's HTML to generatePdf and generateDocx; the connector answers with the file as an attachment.
Both are optional extras: jodit-python[pdf] (plus the Pango system library) and jodit-python[docx], or [all]. Without them the actions answer 501 naming what to install.
PDF¶
generatePdf renders with WeasyPrint:
- Page:
options[format](A4,A3,Letter,Legal,Tabloid) andoptions[page_orientation](portrait,landscape), 1 cm margins; backgrounds are printed. - CSS from
<style>blocks, inline styles and allowed stylesheets applies, with WeasyPrint's print-oriented CSS support (flexbox and grid included). - JavaScript is not run. The editor's HTML is static, so this rarely matters; content that scripts would create does not appear.
- Fonts are those installed on the server. The Docker image ships DejaVu and Liberation (Latin, Cyrillic, Greek). For Chinese, Japanese, Korean and other scripts install more fonts in a derived image, e.g.
apt install fonts-noto-cjk.
DOCX¶
generateDocx converts with html-for-docx (python-docx):
- Supported: headings, paragraphs, bold/italic/underline, lists, tables, links, images and basic inline styles; margins are 0.5".
<style>,<script>and<link>elements are dropped: use inline styles.- Images are embedded; formats Word does not store (WebP...) are converted to PNG, undecodable images are left out.
Complex layouts can come out simpler than in the editor.
Remote resources¶
Images, stylesheets and fonts referenced by URL are loaded by the connector itself, with the same protection as fileUploadRemote:
- only
http/httpsURLs on public addresses (private, loopback and link-local hosts are refused, redirects re-checked); - at most
maxFileSizeper resource,timeoutLimitseconds; data:URIs work;file:URLs and local paths are refused;pdf.isRemoteEnabled: falserefuses every remote resource, for both PDF and DOCX.
A resource that cannot be loaded is left out; the document is still produced.
Request size¶
The HTML travels in the html parameter:
| Encoding | Limit |
|---|---|
| query string | what the proxy and server accept for a URL (a few KB is safe) |
application/x-www-form-urlencoded or JSON body |
100 KB (413 above) |
multipart/form-data field |
1 MB (400 above) |
Jodit posts the export as a form, so documents with large embedded (data:) images may need multipart or links to hosted images instead.