Skip to main content

Replace Text with Image in Word

GenerateReplace 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

Quick reference

Endpoint: POST /api/v2/ReplaceTextWithImageInWord · Required: api-key, docName, docContent, ImageFileName, ImageFileContent, SearchText

Try it live

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.

Loading API Tester...

Overview, parameters, and 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 replaceSearchText is the exact text to find; it is replaced by the image.
  • ImageImageFileContent (Base64), ImageFileName (e.g. sample.png).
  • Page targetingPageNumbers: 1, 1,3,5, 2-5; IsFirstPageSkip to skip the first page.
  • Async – Use async for large documents.
Best for

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.

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).

Get Help