Replace Text with Image in Word
Generate → Replace Text with Image in Word
The Replace Text with Image in Word API replaces specific text in a Word document with an image. You send the document (docContent Base64, docName), the image (ImageFileContent Base64, ImageFileName), SearchText (text to find and replace), optional PageNumbers and IsFirstPageSkip, and async. The API returns the modified Word document. Use the tester below to try it; more details are in the sections that follow.
Try the Replace Text with Image in Word API
Endpoint: POST /api/v2/ReplaceTextWithImageInWord · Required: api-key, docName, docContent, ImageFileName, ImageFileContent, SearchText
Use the form below to send your API key, Word document (Base64), image (Base64), and the text to replace. The response is the document with the image in place of the text. No code required—fill the fields and click Send request.
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Replace Text with Image in Word?
This endpoint finds specific text in a Word document and replaces it with an image. You provide the document (Base64), the image (Base64), SearchText (exact text to find, e.g. a placeholder like SIGN_HERE), optional PageNumbers (e.g. 1, 1,3,5, 2-5) and IsFirstPageSkip. The API returns the Word document with the image in place of the text. Use it to insert logos, signatures, or graphics at placeholder positions.
Key features
- Search and replace – SearchText is the exact text to find; it is replaced by the image.
- Image – ImageFileContent (Base64), ImageFileName (e.g. sample.png).
- Page targeting – PageNumbers: 1, 1,3,5, 2-5; IsFirstPageSkip to skip the first page.
- Async – Use async for large documents.
Use when you need to insert an image at a placeholder in Word (e.g. signature, logo). For PDF use Replace Text with Image or Add Image Stamp to PDF.
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| docName | string | Yes | Output document name (e.g. output.docx). |
| docContent | base64 | Yes | Word document content (Base64). |
| ImageFileName | string | Yes | Image file name (e.g. sample.png). |
| ImageFileContent | base64 | Yes | Image content (Base64). |
| SearchText | string | Yes | Text to find and replace with the image. |
| PageNumbers | string | No | Page(s) to process: 1, 1,3,5, 2-5. |
| IsFirstPageSkip | boolean | No | Skip the first page. |
| async | boolean | No | Enable asynchronous processing. |
When to use Replace Text with Image in Word
- Signatures – Replace a placeholder (e.g. SIGN_HERE) with a signature image.
- Logos and stamps – Insert a logo or stamp at a placeholder in a template.
- Certificates – Place a seal or badge at a fixed text position.
- Templates – Use placeholders in Word templates and replace them with images via API.
For request/response schemas and code samples, see Replace Text with Image in Word in the PDF4me API docs.
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- A Word document in Base64 format
- An image file in Base64 format
Response Format
The API returns the modified Word document as binary data for synchronous processing (200 OK) or provides a polling URL for asynchronous processing (202 Accepted).