113 lines
4.5 KiB
JSON
113 lines
4.5 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "PaperJet Annotation Schema",
|
|
"definitions": {
|
|
"Rect": {
|
|
"type": "object",
|
|
"description": "Bounding rectangle in canonical PDF-point space (top-left origin).",
|
|
"properties": {
|
|
"x": { "type": "number", "description": "X position in PDF points from the left edge of the page CropBox" },
|
|
"y": { "type": "number", "description": "Y position in PDF points from the top edge of the page CropBox" },
|
|
"width": { "type": "number", "minimum": 0 },
|
|
"height": { "type": "number", "minimum": 0 }
|
|
},
|
|
"required": ["x", "y", "width", "height"]
|
|
},
|
|
"AnnotationBase": {
|
|
"type": "object",
|
|
"description": "Common envelope for all annotation types.",
|
|
"properties": {
|
|
"id": { "type": "string", "format": "uuid" },
|
|
"page": { "type": "integer", "minimum": 0, "description": "0-indexed page number" },
|
|
"type": { "type": "string", "description": "Discriminator — drives the tool/handler registries" },
|
|
"rect": { "$ref": "#/definitions/Rect" },
|
|
"rotation": { "type": "number", "default": 0, "description": "Degrees clockwise about rect center" },
|
|
"z": { "type": "integer", "default": 0, "description": "Z-order within the page" },
|
|
"props": { "type": "object", "description": "Type-specific properties, opaque to the server" },
|
|
"createdAt": { "type": "string", "format": "date-time" },
|
|
"updatedAt": { "type": "string", "format": "date-time" }
|
|
},
|
|
"required": ["id", "page", "type", "rect", "props", "createdAt", "updatedAt"]
|
|
},
|
|
"TextProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"text": { "type": "string" },
|
|
"fontFamily": { "type": "string", "default": "Liberation Sans" },
|
|
"fontSize": { "type": "number", "default": 14 },
|
|
"color": { "type": "string", "default": "#000000" },
|
|
"align": { "type": "string", "enum": ["left", "center", "right"], "default": "left" },
|
|
"bold": { "type": "boolean", "default": false },
|
|
"italic": { "type": "boolean", "default": false },
|
|
"lineHeight": { "type": "number", "default": 1.2 },
|
|
"highlightColor": { "type": ["string", "null"] }
|
|
},
|
|
"required": ["text"]
|
|
},
|
|
"DrawProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"paths": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "array",
|
|
"items": { "type": "number" },
|
|
"minItems": 2,
|
|
"maxItems": 2
|
|
},
|
|
"description": "Array of [x, y] points in rect-local space"
|
|
},
|
|
"strokeColor": { "type": "string", "default": "#000000" },
|
|
"strokeWidth": { "type": "number", "default": 2 },
|
|
"opacity": { "type": "number", "minimum": 0, "maximum": 1, "default": 1 }
|
|
},
|
|
"required": ["paths"]
|
|
},
|
|
"SignatureDrawProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"mode": { "type": "string", "const": "draw" },
|
|
"ref": { "type": "string", "description": "Asset reference for the rasterized signature" },
|
|
"strokeColor": { "type": "string", "default": "#000000" }
|
|
},
|
|
"required": ["mode", "ref"]
|
|
},
|
|
"SignatureTypeProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"mode": { "type": "string", "const": "type" },
|
|
"text": { "type": "string" },
|
|
"fontFamily": { "type": "string" },
|
|
"color": { "type": "string", "default": "#000000" }
|
|
},
|
|
"required": ["mode", "text", "fontFamily"]
|
|
},
|
|
"ImageProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ref": { "type": "string", "description": "Asset reference for the uploaded image" },
|
|
"naturalWidth": { "type": "number" },
|
|
"naturalHeight": { "type": "number" }
|
|
},
|
|
"required": ["ref", "naturalWidth", "naturalHeight"]
|
|
},
|
|
"HighlightProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"color": { "type": "string", "default": "#FFEB3B" },
|
|
"opacity": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.3 }
|
|
}
|
|
},
|
|
"ShapeProps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": { "type": "string", "enum": ["rect", "ellipse", "line", "arrow"] },
|
|
"strokeColor": { "type": "string", "default": "#000000" },
|
|
"fillColor": { "type": "string", "default": "transparent" },
|
|
"strokeWidth": { "type": "number", "default": 2 }
|
|
},
|
|
"required": ["kind"]
|
|
}
|
|
},
|
|
"allOf": [{ "$ref": "#/definitions/AnnotationBase" }]
|
|
}
|