Replace Text with Image in Word - Content Swap API
PDF4me Replace Text With Image In Word is a powerful enterprise-grade solution that replaces specific text in Word documents with images through advanced API integration. This comprehensive text replacement service efficiently processes Word documents, providing precise text-to-image substitution, flexible page targeting, intelligent text matching, and advanced document processing capabilities for enhanced document automation and content management. The API processes text replacement by receiving Word documents and images through REST API calls, utilizing advanced text matching technology and intelligent image insertion algorithms for accurate text substitution and professional document processing. With comprehensive support for multiple image formats, flexible page targeting, intelligent text matching, and professional document processing, this solution is ideal for document automation, content management, automated text replacement, and enterprise document workflows that require reliable text-to-image substitution with guaranteed accuracy and consistent output quality. Replace Text With Image In Word documents easily with API for advanced document processing and content management.
Authenticating Your API Request
To access the PDF4me REST API, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user of the REST API.
Key Features
- Precise Text Replacement: Replace specific text in Word documents with images, stamps, or graphics
- Flexible Page Targeting: Target specific pages or process entire documents with custom page ranges
- Multiple Image Formats: Support for various image formats including JPG, PNG, BMP, TIFF, and more
- Intelligent Text Matching: Smart text detection and replacement with case-sensitive matching
- Professional Results: High-quality text replacement with accurate image insertion
- Seamless Integration: RESTful API designed for automated document processing workflows and enterprise system integration
REST API Endpoint
The PDF4me REST API uses standard HTTP methods to interact with resources. All text replacement with image operations are performed through a single endpoint:
- Method: POST
- Endpoint:
/api/v2/ReplaceTextWithImageInWord
Supported Text Replacement Features
The API provides comprehensive support for various text replacement and document processing capabilities:
Text Replacement
- Precise Matching: Replace specific text patterns with images using intelligent text detection
- Case-Sensitive Control: Support for case-sensitive text matching and replacement
- Multiple Instances: Replace all instances of matching text throughout the document
- Professional Results: High-quality text replacement with accurate image insertion
- Advanced Processing: Support for complex text structures and replacement requirements
Page Targeting
- Flexible Page Selection: Target specific pages or process entire documents with custom page ranges
- Page Range Support: Support for individual pages, ranges, and mixed page selection
- First Page Control: Option to skip or include the first page in processing
- Professional Layout: High-quality text replacement with accurate page targeting
- Advanced Processing: Support for various document structures and page targeting scenarios
Image Processing
- Multiple Formats: Support for JPG, PNG, BMP, TIFF, and other popular image formats
- Quality Preservation: Maintain image quality during text replacement operations
- Professional Enhancement: High-quality image processing with accurate text replacement
- Flexible Options: Customizable processing parameters for specific requirements
REST API Parameters
Complete list of parameters for the Replace Text With Image In Word REST API. Parameters are organized by category for better understanding and implementation.
Important: Parameters marked with an asterisk (*) are required and must be provided for the API to function correctly.
Required Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| docName* | String | The source Word document filename with proper .docx extension for text replacement operations. This parameter identifies the input document for text replacement, image insertion, and content management workflows. Required for document identification and processing pipeline management in text replacement operations. | output.docx |
| docContent* | Base64 | The complete content of the source Word document encoded in Base64 format for text replacement processing. This parameter contains the entire document data required for text replacement, image insertion, and content management workflows. Essential for secure document handling and API-based text replacement operations. | JVBERi... |
| Image File Name* | String | The image filename with proper file extension for text replacement operations. This parameter identifies the replacement image for text substitution, image insertion, and content management workflows. Required for image identification and processing pipeline management in text replacement operations. | stamp.png |
| Image File Content* | String | The complete content of the replacement image encoded in Base64 format for text replacement processing. This parameter contains the entire image data required for text substitution, image insertion, and content management workflows. Essential for secure image handling and API-based text replacement operations. | JVBERi... |
| Search Text* | String | The specific text pattern to search for and replace with the provided image. This parameter supports case-sensitive text matching for precise content identification and replacement operations. Enables automated text substitution, content management, and document processing workflows with exact pattern matching capabilities. | Djokovic |
Optional Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Is First Page Skip | Boolean | Control whether to skip the first page during text replacement operations. Set to 'true' to exclude the first page from processing, or 'false' to include all pages. This parameter provides flexibility for document processing workflows that require specific page targeting and content management strategies. | false |
| Page Numbers | String | Specify target pages for text replacement using flexible page selection formats. Supports individual pages ("1, 3, 5"), page ranges ("1-5, 10-15"), mixed formats ("1, 3-7, 10"), or all pages (empty). Enables precise page targeting for optimized performance, selective content editing, and efficient document processing workflows. Page indices start from 1. | 1 |
Output
The PDF4me Replace Text With Image In Word REST API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
{
"File Content": "Output file content from the PDF4me Connect"
}
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| File Content | Output file content from the PDF4me Connect |
Schema View
The data structure and types of the response:
1 item
File Content: Binary Output file content from the PDF4me Connect
Type Indicators:
Binary= Binary data
Binary Data View
The actual processed Word document file data:
data
─────────────────────────────
File Content: Output file content from the PDF4me Connect
Binary Data Access:
- Document Content: Ready for download or further processing
- Processed Document: Complete Word document with text replaced by images
Request Example
Header
Content-Type: application/json
Authorization: YOUR_API_KEY
Note: Get your API key from the PDF4me Dashboard
Payload
{
"docName": "output.docx",
"docContent": "Please put doc base64 content",
"ImageFileName": "stamp.png",
"ImageFileContent": "Please put image base64 content",
"IsFirstPageSkip": false,
"PageNumbers": "1",
"SearchText": "Djokovic"
}
Code Samples
The PDF4me Replace Text With Image In Word REST API provides code samples in multiple programming languages. Choose the language that best fits your development environment:
- C#
- Java
- JavaScript
- Python
- Salesforce
- n8n
- Google Script
- AWS Lambda
Google Script Sample
Google Apps Script implementation for Google Workspace integration:
Text Replacement Features
Text Replacement
- Precise Matching: Replace specific text patterns with images using intelligent text detection
- Case-Sensitive Control: Support for case-sensitive text matching and replacement
- Multiple Instances: Replace all instances of matching text throughout the document
- Professional Results: High-quality text replacement with accurate image insertion
- Advanced Processing: Support for complex text structures and replacement requirements
Page Targeting
- Flexible Page Selection: Target specific pages or process entire documents with custom page ranges
- Page Range Support: Support for individual pages, ranges, and mixed page selection
- First Page Control: Option to skip or include the first page in processing
- Professional Layout: High-quality text replacement with accurate page targeting
- Advanced Processing: Support for various document structures and page targeting scenarios
Image Processing
- Multiple Formats: Support for JPG, PNG, BMP, TIFF, and other popular image formats
- Quality Preservation: Maintain image quality during text replacement operations
- Professional Enhancement: High-quality image processing with accurate text replacement
- Flexible Options: Customizable processing parameters for specific requirements
Industry Use Cases & Applications
- Use Cases
Use Cases
- Document Automation: Automate text replacement in Word documents for content management
- Content Management: Replace text with images, stamps, or graphics for document processing
- Template Processing: Replace placeholder text with actual images in document templates
- Brand Management: Replace text with company logos, stamps, or branded images
- Compliance: Replace text with compliance stamps or regulatory images
- Personalization: Replace text with personalized images for customer communications
- Workflow Automation: Automate text replacement workflows for enterprise operations
- Document Processing: Process large volumes of documents with automated text replacement