Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to get external image to show on the form

Avatar

Former Community Member

Hello,

I would like to know if it is possible to get an image (picture) from external server to show on the form bases on the data that is populated from the web service that was built in workbench ES. Please advise.

Thanks,

Han Dao

7 Replies

Avatar

Level 10

You need to convert the image to a Basde64 encoded string and pass it along with the XML before rendering the PDF.

PDF will display dynamic Images only if they are Base64 encoded.

You can write some bean shell scripting to use Java APIs to convert the image to Base64.

Thanks

Srini

Avatar

Former Community Member

Hi Srini,

Thanks for the quick reply. After convert the image to base63 encoded, how do I pass it along with XML in LiveCycle Designer? Can you please advise.

Thanks,

Han Dao

Avatar

Level 10

If you are rendering the form from the workbench, beforeyou use the RederForm service, place a ExecuteScript service and then write code to append the Base64 encoded String to the XML tag. Basically it is a string concatenation.

"<?xml......

.

.

.

.

.

"

+ <imageData>" +   Pass Your Base64 String Here +   "</imageData> +

"

.

.

.

.

"

Use this XML variable in your RenderForm service..

Can this give you an idea..

Thanks

Srini

Avatar

Former Community Member

Wow. It looks great. I will try it and let you know the results next week.

Thanks alot.

Han Dao

Avatar

Former Community Member

Hi Srini,

I try it but I think I got confused to make it work right. Do you have a sample, can you please provide one.

Thanks again,

Han

Avatar

Level 10

Here is a sample code for converting the image to Base64 encoded..At the end of the scripting, the Base64 encoded string will be assigned to a local variable. You can add this variable to the XML before the rendering.

https://acrobat.com/#d=dDMnM4dk-wg-Eo79D1fiRQ

Thanks

Srini

Avatar

Former Community Member

Hi Srini,

Thank you for the replies. I am still confusing at the part of making it work in the form. Do you have a sample form that you can share, I would appreciate much since I could not make it work right.

Thanks again.

Han Dao