BoxDoc
BoxDoc ist ein KI-nativer Dokumenten-Editor. Dokumente sind
.boxdoc-Dateien: Pretty-JSON, UTF-8. Das IST die komplette
Schnittstelle — kein separates Protokoll, keine Authentifizierung nötig.
Schnellstart (HTTP)
# Neues Dokument erstellen
curl -X POST "https://boxdoc.at/index.php?new=1&name=meindokument"
# Dokument lesen (JSON)
curl "https://boxdoc.at/index.php?get=meindokument"
# Dokument überschreiben — DATEI-BASIERT (empfohlen, kein Escaping nötig)
curl -X PUT --data-binary @doc.json "https://boxdoc.at/index.php?put=meindokument"
# Alle Dokumente auflisten
curl "https://boxdoc.at/index.php?list=1"
JSON-Regeln (WICHTIG)
- Format: Pretty-JSON oder minifiziert — beides akzeptiert. Für Inline-curl empfohlen: minifiziert (eine Zeile).
- Zeilenumbrüche in Texten: Als
\n im JSON-String schreiben, nicht als echte Zeilenumbrüche.
- Anführungszeichen in Texten: Als
\" escapen.
- Backslash: Als
\\ escapen.
- Shell-Escaping (curl): JSON in Single Quotes
'{...}' setzen — schützt vor der Shell. Enthält der Text selbst ', stattdessen Datei (-d @file.json) verwenden.
- Sicherster Weg: JSON in Datei speichern, mit
--data-binary @datei.json senden. Dann gelten nur JSON-Regeln, keine Shell-Regeln.
Beispiel — Inline (minifiziert):
curl -X PUT --data-binary '{"doc":{"format":"A4","orientation":"Portrait","pages":[{"elements":[{"id":1,"kind":"Text","x":50,"y":50,"w":400,"h":40,"rotation":0,"text":"Hallo\nWelt","font_size":14,"font":"default","color":[20,20,20,255],"bold":false,"italic":false,"underline":false,"align":"Left","valign":"Top","indent":0,"crop":{"x":0,"y":0,"w":1,"h":1},"image_w":0,"image_h":0,"fill_color":[0,0,0,0],"stroke_width":0,"stroke_color":[0,0,0,0],"corner_radius":0}]}]},"images":[]}' "https://boxdoc.at/index.php?put=meindokument"
Dateiformat
{
"doc": {
"format": "A4 | A3 | A5 | Letter | Legal",
"orientation": "Portrait | Landscape",
"pages": [
{ "elements": [ <Element>, ... ] }
]
},
"images": [
{ "id": 1, "png_base64": "<base64-PNG>" }
]
}
Element
{
"id": <u64>,
"kind": "Text | Image | Rectangle | Line",
"x": <f32 pt>, "y": <f32 pt>,
"w": <f32 pt>, "h": <f32 pt>,
"rotation": <Grad>,
"text": "<Inhalt>",
"font_size": <pt>,
"font": "default|inter|roboto|lora|jetbrains|pacifico",
"color": [r, g, b, a],
"bold": false, "italic": false, "underline": false,
"align": "Left|Center|Right",
"valign": "Top|Middle|Bottom",
"indent": 0.0,
"crop": { "x": 0.0, "y": 0.0, "w": 1.0, "h": 1.0 },
"image_w": 0, "image_h": 0,
"fill_color": [r, g, b, a],
"stroke_width": 2.0,
"stroke_color": [r, g, b, a],
"corner_radius": 0.0
}
Element-Typen
- Text: text, font_size, font, color, bold, italic, underline, align, valign
- Rectangle: fill_color, stroke_width, stroke_color, corner_radius
- Line: stroke_width, stroke_color (h=0, rotation für Winkel)
- Image: id (→ images[].id), crop, image_w, image_h
Koordinatensystem
- Maßeinheit: Punkt (1 pt = 1/72 Zoll; 1 cm ≈ 28,3 pt)
- Ursprung: oben-links, y zeigt nach unten
- A4 Hochformat: 595 × 842 pt
- IDs sind u64 und stabil. Neue Elemente: höchste ID + 1
- Z-Order: Elemente weiter hinten im Array liegen oben
- Bilder (images[], png_base64) unverändert lassen
Beispiel: Neues Text-Element
{"id": 42, "kind": "Text",
"x": 100, "y": 200, "w": 400, "h": 40, "rotation": 0,
"text": "Neuer Text", "font_size": 14, "font": "default",
"color": [20,20,20,255], "bold": false, "italic": false, "underline": false,
"align": "Left", "valign": "Top", "indent": 0,
"crop": {"x":0,"y":0,"w":1,"h":1}, "image_w": 0, "image_h": 0,
"fill_color": [80,140,220,60], "stroke_width": 0,
"stroke_color": [40,100,180,255], "corner_radius": 0}
Weiterführend