2 Replies Latest reply on Oct 17, 2008 4:40 AM by kc@dafolo.dk

    Getting image from attachment into image field in a form

    kc@dafolo.dk Level 1
      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
        • 1. Re: Getting image from attachment into image field in a form
          pguerett Level 6
          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.
          • 2. Re: Getting image from attachment into image field in a form
            kc@dafolo.dk Level 1
            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