How to append the content of attachments to a PDF file

Requirement: Generate a PDF file that should contain the content of the case attachement. There can be various types of document attached to a case. From pc_data_workattach fetch the byte stream and append the content of those attachments to the PDF file.

How PDF is currently generated:

  1. The PDF is generated using an activity, using the concept of “HTMLtoPDF”
  2. An HTML stream is used where a section is referred

Approach to append the attachment content to the PDF:

  1. We need to attach the content of attached file in this section. Created a section and unchecked the ‘Auto-generated HTML’. We have fetched pyAttachStream from pc_data_workattach and tried following code in this section.
  1. Passing the InputStream as image source (For Image file)

<HTML><img src='InputStream' />

  1. Passing the value of InputStream as object.

<object> <pega:reference name="Property.pyAttachStream" /> </object>

The Inputstream is displayed in PDF instead of the content.

With this approach we’re unable to generate the PDF with the content of the attachment.


Keep up to date on this post and subscribe to comments

September 20, 2019 - 1:38pm


Could you try using a attach content smart shape? 

You can check the following link for more information: