Crow Canyon Software Forum

Forum Navigation
Please or Register to create posts and topics.

Is it possible to merge images into a Word template with Generate Document?

Hi,

I’m trying to generate a document with NITRO Custom Actions that includes a signature image for the current user. In the CA I generate a variable called fileName that holds the full URL to the PNG in a SharePoint library.

So far I’ve tried using a Word template with:

{ INCLUDEPICTURE "{ MERGEFIELD fileName }" \d }

This works in principle, but the image doesn’t update automatically when the document is generated — Word seems to cache the placeholder image unless a manual Ctrl+A → F9 refresh is done. Since the document is being generated server-side and converted straight to PDF, there’s no chance for a user to update the fields manually.

Main question:
Is there a supported way in NITRO to merge images (based on a variable like fileName that resolves to a SharePoint URL) into a Word template so that they reliably appear in the generated document/PDF without requiring a manual refresh?

Also tried:
I added a Picture Content Control in the template (with Title/Tag set, and using Microsoft Office API for the action). However, the picture control never shows up under “Content Control Mappings.” Text and Rich Text controls appear fine, but Picture controls don’t.

Any guidance on whether image merge is possible directly through Merge Fields, or if Picture Content Controls are supported, would be much appreciated.

Thanks,
Art

Hi Art,

Please follow the below steps to generate and show the image in the generated document:

  1. Build the image URL to use in the variable within the custom action, following this format:

https://<tenant>/sites/<site>/<library>/Name.png

  • Replace <tenant> with your tenant name
  • Replace <site> with your site name
  • Replace <library> with your library name
  • Replace Name.png with the actual image name stored in the SharePoint library

 

  1. Create a new variable in the custom action:

Open custom action → Variable → New variable → insert the HTML <img> tag using the image URL you built as shown in image 1. For example:

<img src = "https://<tenant>/sites/site/library/Name.png" alt="Example Image" width="300">

 

  1. Save the variable → Configure the ‘generate document’ action → set up the merge field mapping as shown in image 2
  2. Publish the custom action and check the results.

 

 

Uploaded files:
  • 1.png
  • 2.png

Hi, thanks for the info. I’ve already got the CA side working the way you described — I generate the fileName variable so it resolves to a URL like:

https://tenant.sharepoint.com/sites/SITE/SiteAssets/Images/user.png

That’s confirmed in the debugger and shows correctly in { MERGEFIELD fileName } inside the template. If I hard-code that same URL in an { INCLUDEPICTURE } field, the image displays fine.

Where I’m stuck is the Word side. I’ve tried:

  • { INCLUDEPICTURE "{ MERGEFIELD fileName }" \d } → doesn’t render the image (either shows an error or just the URL).

  • Passing the value as Plain Text, Normal, HTML, Hyperlink → no change.

  • Using a Picture Content Control (Title/Tag set, Office API selected) → control never shows up in Content Control Mappings; only Text/Rich Text do.

So the variable and the URL are good — but I don’t know what the recommended way is to configure the template for images.

Question: How should the Word template be set up on the document side so NITRO can reliably insert an image from a variable URL during generation (without requiring manual field refresh)?

Thanks,
Art