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

read file content and display in text field

cyprd
Registered: Oct 21 2008
Posts: 49

Hi,

is it possible to read a simple text file and display its content in the text field?
And if so, is it possible to encode the content with base64?
The goal is to get file attachments binded to submited XML data and encode those attachments with base64

Thanks

Jan

Adobe LiveCycle ES 8.2.1 (JBoss & Win)

My Product Information:
Reader 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
It's probably possible using the importDataObject() and getDataObjectContents() methods of a document.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

cyprd
Registered: Oct 21 2008
Posts: 49
Hi,

I did try that, but I am getting only let's say text content. It won't display jpeg file content, doc file and tons of others :-(
My goal is to map XML schema to that form and to add that file attachment(s) to the XML as base64 encoded binary data.

I have tried to get that done through imageField. I can pull that base64 encoded file from there, however I am not able to dynamicaly populate that component.

My knowledge in this is very limited (I started to play around two weeks ago). What it should look like at the end is that user get's a PDF form with a button and a text field (and one hidden). Once he clicks on the button, it prompts him for file attachment (so far so good, this works), once completed, the textfield before the button displays the filename the user chose (so far so good here too)
The hidden field should contain base64 encoded data of that file so I can include it in the XML submited by HTTP service

Adobe LiveCycle ES 8.2.1 (JBoss & Win)

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Using these methods you can only read simple text. Acrobat doesn't know how to parse DOC files, for example. But if you save the text from a DOC file to a simple TXT file, you will be able to open it. The same applies to JPG's, although it might be possible to load them using different methods.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

maxwyss
Registered: Jul 25 2006
Posts: 255
cyprd wrote:
is it possible to read a simple text file and display its content in the text field?
Yes, this is possible. As already said, it can be done using a data object.

Quote:
And if so, is it possible to encode the content with base64?
Yes, field values can be encoded with base64; there are JavaScript implementations of the base64 encoding floating around, and as they are strictly limited to Core functions, they work with Acrobat JavaScript.

Hope this can help.

Max.
maxwyss
Registered: Jul 25 2006
Posts: 255
try67 wrote:
Using these methods you can only read simple text. Acrobat doesn't know how to parse DOC files, for example. But if you save the text from a DOC file to a simple TXT file, you will be able to open it. The same applies to JPG's, although it might be possible to load them using different methods.
Well, originally, the question was about "simple text files"...

Acrobat does have XML-handling capabilities (via E4X, introduced with Acrobat 8). This means that it might be possible to interpret Data Objects in XML form. However, I am not sure if it is able to unpack zipped contents (as you would see in an OpenOffice file).

Hope this can help.

Max.
cyprd
Registered: Oct 21 2008
Posts: 49
Thanks guys for your posts.
I need to figure out how to include complex file structures in to the XML (zip, jpeg, doc, cad, and whatever else)

Cheers anyway

Adobe LiveCycle ES 8.2.1 (JBoss & Win)