Highlighted

Getting image from attachment into image field in a form

Avatar

Avatar

kc

Avatar

kc

kc

16-10-2008

Hi all,



I have a process where a customer sends in a PDF with an attached image. This image is then stored in a process variable and I need to put it in another form.



Any ideas how to do this most efficiently?



Sincerely

Kim

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

16-10-2008

Put the image contents base64 encoded into the data file and merge it onto the template. Bind the image field to the data field that holds the image.
Highlighted

Avatar

Avatar

kc

Avatar

kc

kc

17-10-2008

Hi Paul,



I did what you suggested, here goes in more detail:



1. I use processFormSubmission for getting the attacment out of the document (might be possible in another way though).

2. I loop through the list of attachments to get to one I need

3. When I find it I use "getDocContentBase64(doc)" method and saves to string

4. I store the string in my xfaform (in a normal textfield)

5. On the form I have some simple code on initialize that sets the data from the textfield to be assigned to the image field for the image.



Thats it...simple eh 🙂



PS: There is a glitch in the Help for LC 8.2, it says that there is a " getDocFromBase64(aString)" method available, but it is not there...



Sincerely

Kim