Expand my Community achievements bar.

Dynamically set image path

Avatar

Level 4

Hello all,

I've created a XFA Dynamic form that imports a number of records from one of our local databases. One of these fields is the path to an image. I would like to set an image field to that url... or, better still, embed the image into the .pdf form itself.

Everything that I've read has told me that the only way to do so is to set the image field's raw value to a base64 string representation of that image. This isn't an option, as I have no way to convert that image to base64.... unless I can do so via SQL or javascript. I've been trying to do this for a few days with no luck.

I figure that I'm not the only one who has had this porblem. I was hoping that someone out there has developed a solution that they would be willing to share. I'd appreciate any help that anyone might be able to offer. Thanks =)

- Scott

3 Replies

Avatar

Former Community Member

Hello Scott,

click on the image Field. Pres Shift+F7. the object properties Palette appears on the right.

On the Object Tab --> Field Tab -->  there are 2 properties

URL and a check Box called Embed Image data.

Will these help ?

If not, Try setting the Binding value of the Image field to a Data connection field , that will hold the url at run time

Let me know if this helped

Nanda

Avatar

Level 4

Hi there,

Thanks for your reply. The URL field is useful only to set a default image path. under the binding tab, when I bind the image to the url from a data connection, the url is displayed as text within the image field. No image appears.

The only solution that I've found online is to somehow get the image converted to base64... the issue is that the only technologies that I have available to me are SQL or javascript... neither of which were designed to convert images to base64.

Does onyone know where I can find a javascript function to convert an image to base64?

- Scott

Avatar

Former Community Member

Hello Scott,

I am using Images in my form too., But we dont store the path of the image in our database. We store the image itself as a blob in the database table datatype varbinary(max). We are using SQlServer 2008. So binding the Image field to the blob object displays it perfectly, no extra conversion is required.

Is that an option for you ?

regards

Nanda