Support Article
pzGenerateDocument fails to embed dynamic images
SA-79035
Summary
A Word Merge document template is configured to embed dynamic images through the following nested field codes.
{pega:binary binaryfile ={ pega:reference .WhichImage }}
After converting this document, to be generated server-side, using pzGenerateDocument, the images are not embedded.
Error Messages
Field Codes: pega:attachment/ pega:binaryfile/ pega:binary are not supported in the current documentation. Please use pzInsertDocumentObject to achieve the same functionality.
Steps to Reproduce
- Convert the Word Merge template document from .doc to .docx.
- Use the following API
@(Pega-AppDefinition:DocumentApp ).pzGenerateDocument("Your_Template", tools,"Your_Class",null)
- Use the below Field code to embed the binary images.
{pega:binary binaryfile ={ pega:reference .WhichImage }}
Root Cause
The Field codes used by Word Merge are not supported by the pzGenerateDocument DCO API.
Resolution
Perform the following local-change:
- Create an HTML rule and embed this in a Corr rule which is referenced in the Word template.
- In the HTML rule, define the following tags,
<PegaDocumentObject><pega:reference name=".WhichImageInsKey"/></PegaDocumentObject>
The property in this scenario contains the full pzInsKey of the image binary which is embedded.
This is resolved as below:
<PegaDocumentObject>RULE-FILE-BINARY WEBWB IMAGE1!PNG #20190327T184956.304 GMT</PegaDocumentObject>
Published May 17, 2019 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.