These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How can I create an image file from image field data

CodyC
Registered: Dec 4 2007
Posts: 2

I have used LiveCycle Designer to create a form with an imageField and several text fields. I have a submit button that allows users to send the form data by email. In the email, I receive the embedded image data. How can I take the data in the imageField and use it to create an image file?

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are two paramters associated with the image data, "contentType" and "transferEncoding". The "contentType" is the MIME type for the image data, "bmp", "JPEG", "GIF", etc.

Images are binary data, so if the data format is text, you can't very well transfer the data raw. To deal with this issue the data is encoded into a text friendly format. The "transferEncoding" is the encoding technique used to create this textfriendly format. It is amost guarenteed to be "Base64".

So, to save the data as an image file there are two steps.

1. Acquire the image data and Unencode it to binary data. Exactly how this is done depends entirely on your development environment and the libraries you have availible. ".Net", "Java", and "JavaScript" all have built-in Base64 encoders and decoders.

2. Write the decoded data to a file this the extension that matches the MIME type for the data.

That's it.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script