replace_text_with_image
Replace specific text in a PDF with an image. Provide the PDF, image, text to find, and page range to place the image exactly where the text occurs.
Instructions
Replace occurrences of a text string in a PDF with an image using the PDF4me ReplaceTextWithImage API (POST /api/v2/ReplaceTextWithImage). Provide the PDF path, image path, text to replace, page sequence (e.g. all, 1, 1,3,5, 2-5), and image width/height in pixels. Supports async via isAsync and 202 Location polling. Optional output directory and file name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Local path to the input PDF. | |
| output_dir | No | ||
| image_width | No | Display width of the placed image in pixels (API integer). | |
| image_height | No | Display height of the placed image in pixels (API integer). | |
| replace_text | Yes | Literal text in the PDF to replace with the image. | |
| page_sequence | No | Pages to search (e.g. "all", "1", "1,3,5", "2-5"). | all |
| image_file_path | Yes | Local path to the replacement image (e.g. PNG, JPG). | |
| output_file_name | No |