Replace Text with Image in Word using Power Automate
PDF4me Replace Text with Image action enables replacing specified text with images in Word documents in Power Automate with advanced page filtering and size control options. This powerful text replacement feature supports precise text matching, image insertion, customizable sizing with aspect ratio preservation, page-specific targeting, and flexible filtering options with full control over replacement behavior, perfect for document automation, template processing, and dynamic content insertion workflows across Microsoft 365.
Authenticating Your API Request
To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user, enabling seamless integration between your Power Automate flows and PDF4me's powerful Word text replacement services.

Key Features
- Text-to-Image Replacement: Replace specific text strings with images throughout documents
- Precise Text Matching: Case-sensitive text search and replacement
- Image Size Control: Customize image dimensions with width and height parameters
- Aspect Ratio Preservation: Maintain image proportions during resizing
- Page Filtering: Target specific pages or page ranges for replacement
- Advanced Filtering: Skip first page, target odd/even pages, or specify exact page numbers
- Multiple Image Formats: Support for PNG, JPG, JPEG, BMP, GIF formats
- Flexible Positioning: Insert images as Word shapes with precise positioning
Parameters
Complete list of parameters for the Replace Text with Image action. Configure these parameters to control text replacement behavior.
Important: Parameters marked with an asterisk (***) are required. Advanced parameters provide fine-grained control over image sizing and page filtering.
| Parameter | Type | Description | Example |
|---|---|---|---|
| File Content*** | Base64 | Source Word File Content • Map Word file from previous action output • Supports Word files from SharePoint, Dropbox, OneDrive, email attachments • Can be dynamically retrieved from flow variables • Direct base64 can be given in the file content also • Must be valid Word document (.docx, .doc formats) • Text replacement is performed on this document | [File Content from Get File] |
| File Name*** | String | Word Document Name • Specify Word file name with extension (.docx, .doc) • Used for processing and output file naming • Must include proper file extension • Supports dynamic naming from flow variables • Output filename matches input filename | document.docx |
| Search Text*** | String | Text to Search and Replace • Text string to search for in the document • Case-sensitive text matching • All instances of this text will be replaced with the image • Cannot be null or empty • Examples: "[LOGO]", "SIGN_HERE", "[SIGNATURE]" | "SIGN_HERE" |
| Image Content*** | Base64 | Replacement Image Content • Base64-encoded content of the image file • Map image file from previous action output or file upload • Supports image files from SharePoint, OneDrive, email attachments • Can be dynamically retrieved from flow variables • Direct base64 can be given in the file content also • Must be valid image file (PNG, JPG, JPEG, BMP, GIF formats) | [File Content from Get File] |
| Image Width | Number (double) | Image Width in Points • Width of the replacement image in points • Optional - if not specified, uses original image width • Must be positive value • If only Width specified, Height calculated to maintain aspect ratio • Used with Height for precise sizing control • Image sizing behavior: Width only = calculates height to maintain aspect ratio | 200 |
| Image Height | Number (double) | Image Height in Points • Height of the replacement image in points • Optional - if not specified, uses original image height • Must be positive value • If only Height specified, Width calculated to maintain aspect ratio • Used with Width for precise sizing control • Image sizing behavior: Height only = calculates width to maintain aspect ratio | 150 |
| Maintain Aspect Ratio | Boolean | Preserve Image Proportions • Yes - Maintains original image aspect ratio when resizing • No - Uses exact width and height values (may distort image) • Default: Yes • When Yes, one dimension is calculated to preserve proportions • When No, both dimensions are used exactly as specified • Image sizing behavior: Both dimensions + MaintainAspectRatio = Yes = calculates one dimension to preserve proportions | Yes |
| Skip First Page | Boolean | Skip Replacement on First Page • Yes - Skip text replacement on the first page • No - Include first page in replacement process • Default: No • Useful when first page is a cover page or title page • Applied before other page filtering options | No |
| Apply To Pages | String | Apply Replacement to Specific Page Types • all - Apply to all pages (default) • odd - Apply only to odd-numbered pages • even - Apply only to even-numbered pages • first - Apply only to the first page • last - Apply only to the last page • Advanced parameter for precise page targeting • Page filtering order: Apply To Pages → Page Numbers → Skip First Page → Ignore Page Numbers | "all" |
| Page Numbers | String | Specific Page Numbers or Ranges • Comma-separated page numbers or ranges (e.g., "1,3,5-7") • Advanced parameter for targeting specific pages • Can be used with Apply To Pages for combined filtering • Examples: "1,3,5", "2-4,6,8-10" • Invalid page numbers are silently ignored • Example: Apply To Pages = "odd" + Page Numbers = "1,3,5-7" = Pages 1, 3, 5, 7 | "1,3,5-7" |
| Ignore Page Numbers | String | Page Numbers to Skip • Comma-separated page numbers to exclude from processing • Advanced parameter for excluding specific pages • Applied after other page filtering options • Examples: "2,4", "1,3,5" • Useful for excluding cover pages or specific sections • Example: Apply To Pages = "all" + Ignore Page Numbers = "2,4" = All pages except 2 and 4 | "2,4" |
| Culture Name | String | Document Culture/Locale • Culture code for document processing (e.g., "en-US", "fr-FR", "de-DE") • Default: null (no culture-specific processing) • Affects document language and formatting • Use valid culture codes for international documents • Used for metadata and localization handling | en-US |
Output
The PDF4me Replace Text with Image action returns comprehensive output data for seamless Power Automate flow integration:
- Table
- JSON
- Flow Integration
Table View
Response data in a structured table format:
| Parameter | Type | Description |
|---|---|---|
| document | Base64 | Word document with text replaced by images |
| Success | Boolean | true if operation successful, false if failed |
| Error Message | String | Error description (null if successful) |
| Errors | Array | List of detailed error information (empty array if successful) |
JSON Response Format
The raw JSON response from the action:
{
"document": "[Base64 Word Content with Text Replaced by Images]",
"Success": true,
"ErrorMessage": null,
"Errors": []
}
Error Response Example:
{
"document": null,
"Success": false,
"ErrorMessage": "FindText is required for text replacement",
"Errors": [
{
"Code": "VALIDATION_ERROR",
"Message": "Search Text parameter cannot be null or empty"
}
]
}
Power Automate Flow Usage
Use documents with replaced text in subsequent actions:
- Document Automation: Replace placeholder text with dynamic images
- Template Processing: Insert logos, signatures, or charts into templates
- Document Personalization: Add personalized images to documents
- Report Generation: Insert charts and graphs into reports
- Email Distribution: Send documents with replaced images to stakeholders
- Archive Storage: Store processed documents in document libraries
Common Error Messages
Understanding and troubleshooting errors helps ensure smooth text replacement workflows:
| Error Message | Cause | Solution |
|---|---|---|
| "Request is empty" | Request object is null | Provide valid request object |
| "Document is empty" | Document object is null | Provide valid Word document |
| "FindText is required for text replacement" | Search Text is null or empty | Provide valid text to search for |
| "Image content is required" | Image Content is null or empty | Provide valid base64-encoded image content |
| "Error replacing text with image" | General exception during text replacement | Check document format, image format, and parameters. Review exception details in Errors array |
| "Error loading document from bytes" | Invalid or corrupted Word document | Verify the input document is a valid Word file (.docx) |
| "No pages match the filtering criteria" | Page filtering resulted in no pages to process | Adjust page filtering parameters |
| "Invalid culture name provided. Skipping metadata." | Invalid culture/locale code provided | Use valid culture codes (e.g., en-US, fr-FR, de-DE) |
Workflow Examples
The PDF4me Replace Text with Image action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:
- Template Processing
- Signature Insertion
- Chart Insertion
- Watermark Insertion
Automated Template Processing Workflow
Streamline your document generation with automated template processing:
Complete Workflow Steps:
- Trigger: Document template ready for processing in SharePoint
- Get Template: Retrieve Word template from templates library
- Get Company Logo: Retrieve company logo image from assets
- Replace Logo Placeholder: Replace "[LOGO]" text with company logo
- Set Parameters: Search Text = "[LOGO]", Image Width = 200, Maintain Aspect Ratio = Yes
- Skip First Page: Skip First Page = No (include cover page)
- Email Processed Document: Send processed document to stakeholders
- Archive Template: Store processed document in completed templates folder
Business Benefits:
- Processes 100+ document templates monthly automatically
- Replaces placeholder text with company branding
- Ensures consistent logo placement and sizing
- Reduces manual template processing time by 90%
Automated Signature Insertion Workflow
Enhance your document processing with automated signature insertion:
Complete Workflow Steps:
- Trigger: Document ready for signature in SharePoint
- Get Document: Retrieve Word document from signature queue
- Get Signature Image: Retrieve authorized signature image from secure storage
- Replace Signature Placeholder: Replace "SIGN_HERE" text with signature image
- Set Parameters: Search Text = "SIGN_HERE", Image Width = 300, Height = 100
- Set Aspect Ratio: Maintain Aspect Ratio = Yes for proper signature proportions
- Skip First Page: Skip First Page = Yes (preserve cover page)
- Email Signed Document: Send signed document to stakeholders
Business Benefits:
- Inserts 200+ signatures monthly automatically
- Replaces signature placeholders with authorized signatures
- Maintains proper signature sizing and proportions
- Reduces manual signature insertion time by 95%
Automated Chart Insertion Workflow
Optimize your report generation with automated chart insertion:
Complete Workflow Steps:
- Trigger: Report template ready for chart insertion
- Get Report Template: Retrieve Word report template from templates library
- Get Chart Image: Retrieve generated chart image from analytics system
- Replace Chart Placeholder: Replace "[CHART_1]" text with chart image
- Set Parameters: Search Text = "[CHART_1]", Image Width = 400, Height = 300
- Set Aspect Ratio: Maintain Aspect Ratio = Yes for chart clarity
- Skip First Page: Skip First Page = No (include executive summary)
- Email Report: Send report with inserted charts to management
Business Benefits:
- Inserts 50+ charts monthly automatically
- Replaces chart placeholders with generated analytics
- Maintains chart quality and readability
- Reduces manual chart insertion time by 85%
Automated Watermark Insertion Workflow
Enhance your document security with automated watermark insertion:
Complete Workflow Steps:
- Trigger: Document ready for watermarking in SharePoint
- Get Document: Retrieve Word document from watermark queue
- Get Watermark Image: Retrieve appropriate watermark image from assets
- Replace Watermark Placeholder: Replace "[WATERMARK]" text with watermark image
- Set Parameters: Search Text = "[WATERMARK]", Image Width = 200, Height = 200
- Set Aspect Ratio: Maintain Aspect Ratio = Yes for watermark consistency
- Skip First Page: Skip First Page = Yes (preserve cover page)
- Archive Watermarked Document: Store watermarked document in secure library
Business Benefits:
- Inserts 150+ watermarks monthly automatically
- Replaces watermark placeholders with security watermarks
- Maintains consistent watermark sizing and appearance
- Reduces manual watermark insertion time by 90%
Image Sizing Examples
Understanding image sizing behavior helps optimize your text replacement workflows:
| Width | Height | Maintain Aspect Ratio | Result |
|---|---|---|---|
| 200 | null | Yes | Width=200, Height=calculated to preserve proportions |
| null | 150 | Yes | Width=calculated to preserve proportions, Height=150 |
| 200 | 100 | Yes | Width=200, Height=100 (aspect ratio maintained) |
| 200 | 100 | No | Width=200, Height=100 (exact dimensions, may distort) |
| null | null | Yes | Original image dimensions preserved |
Supported Image Formats
The Replace Text with Image action supports various image formats for maximum compatibility:
| Format | Extension | Description |
|---|---|---|
| PNG | .png | Portable Network Graphics - best for logos and graphics with transparency |
| JPEG | .jpg, .jpeg | Joint Photographic Experts Group - best for photographs and complex images |
| BMP | .bmp | Bitmap - uncompressed format, larger file sizes |
| GIF | .gif | Graphics Interchange Format - supports animation and transparency |
Industry Use Cases & Applications
- Legal & Professional Services
- Finance & Accounting
- Sales & Marketing
- Human Resources
- Healthcare & Medical
- Education & Research
Legal & Professional Services Use Cases
- Contract Processing: Replace signature placeholders with authorized signatures
- Legal Document Automation: Insert firm logos and watermarks into legal documents
- Client Document Personalization: Add client-specific images to legal documents
- Compliance Documentation: Insert compliance stamps and seals into documents
Finance & Accounting Use Cases
- Financial Report Generation: Insert charts and graphs into financial reports
- Invoice Processing: Replace logo placeholders with company logos
- Audit Documentation: Insert audit stamps and signatures into audit reports
- Budget Report Automation: Insert budget charts into budget documents
Sales & Marketing Use Cases
- Proposal Generation: Insert company logos and product images into proposals
- Marketing Material Creation: Replace placeholder text with marketing images
- Client Presentation Automation: Insert client-specific images into presentations
- Sales Report Generation: Insert sales charts and graphs into reports
Human Resources Use Cases
- Employee Document Processing: Insert company logos into employee documents
- Policy Document Generation: Insert policy stamps and approval signatures
- Training Material Creation: Insert training images and diagrams into materials
- Compliance Document Processing: Insert compliance stamps into HR documents
Healthcare & Medical Use Cases
- Medical Report Generation: Insert medical charts and diagrams into reports
- Patient Document Processing: Insert medical facility logos into patient documents
- Research Documentation: Insert research charts and graphs into research papers
- Compliance Documentation: Insert medical compliance stamps into documents
Education & Research Use Cases
- Academic Paper Generation: Insert research charts and graphs into academic papers
- Curriculum Document Creation: Insert educational images into curriculum materials
- Student Document Processing: Insert institution logos into student documents
- Research Report Generation: Insert research visualizations into research reports