Skip to content

Commit 9819649

Browse files
ochafikclaude
andcommitted
pdf-server: remove imageData from image annotation API, require imageUrl
Models were encoding images as base64 themselves instead of passing file paths. Remove imageData from the model-facing Zod schema entirely — only imageUrl (file path or HTTPS URL) is accepted. The server fetches and embeds the image automatically. imageData remains as an internal field for client-side rendering and drag-drop. Also mention drag-and-drop as an alternative in the tool description. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b5f76fa commit 9819649

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

examples/pdf-server/server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,10 @@ const ImageAnnotation = AnnotationBase.extend({
180180
y: z.number().optional(),
181181
width: z.number().optional(),
182182
height: z.number().optional(),
183-
imageData: z
184-
.string()
185-
.optional()
186-
.describe(
187-
"Base64-encoded PNG or JPEG image data (no data: prefix). Prefer imageUrl with a file path instead of encoding images yourself.",
188-
),
189183
imageUrl: z
190184
.string()
191-
.optional()
192185
.describe(
193-
"File path or HTTPS URL to the image. NO data: URIs — use imageData for raw base64. Prefer file paths over encoding images yourself.",
186+
"File path or HTTPS URL to a PNG/JPEG image (e.g. signature, logo). NO data: URIs. The user can also drag & drop images directly onto the viewer.",
194187
),
195188
mimeType: z
196189
.string()
@@ -1817,7 +1810,7 @@ Annotation types:
18171810
• rectangle: x, y, width, height, color?, fillColor?, rotation? • circle: x, y, width, height, color?, fillColor?
18181811
• line: x1, y1, x2, y2, color? • freetext: x, y, content, fontSize?, color?
18191812
• stamp: x, y, label (any text, e.g. APPROVED, DRAFT, CONFIDENTIAL), color?, rotation?
1820-
• image: imageUrl or imageData, x?, y?, width?, height?, mimeType?, rotation?, aspect? — places an image (signature, logo, etc.) on the page. imageUrl accepts a local file path or HTTPS URL (NO data: URIs). Do NOT base64-encode images yourself — just pass the file path via imageUrl and the server fetches and embeds it. Width/height auto-detected if omitted.
1813+
• image: imageUrl (required), x?, y?, width?, height?, mimeType?, rotation?, aspect? — places an image (signature, logo, etc.) on the page. Pass a local file path or HTTPS URL (NO data: URIs, NO base64). Width/height auto-detected if omitted. Users can also drag & drop images directly onto the viewer.
18211814
18221815
TIP: For text annotations, prefer highlight_text (auto-finds text) over manual rects.
18231816

0 commit comments

Comments
 (0)