Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Opening a File Attachment

Avatar

Level 2

Hi all,

My scenario is as follows:

I have a Adobe Form which will have file attachments. The Form with the attachments will be sent from the SAP R/3 system itself. My work is to open the file which I am unable to do. Those attached files can be seen in the attachments option in the Adobe Reader and can open from there, but I am not able to open through my code. All the attached file's name, id and description are displayed in the table. Upon clicking the file name, the attachment should open. I have wrote the code for opening attachment which is working fine when I attach files in the Adobe Reader using a button click event (just using browse button and importDataObject method). The same code fails when I try to open the file which is received from the R/3 system.

I dont have a clue for what to do to import the file attachment and how can I relate the attachment with the fileID. Any help is of great use to me since I am new to this technology.

 

 



1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Niall and everyone,

I was able to solve the issue. I displayed all the attached files name in a table in my form and used myDoc.dataObjects to get the attached files and used row index of that particular filename in the table data to open the particular file. For opening the file, as usual I used the exportDataObject.

If anyone want the code reference, this is my mailid: sujaikareik@gmail.com. Once again, thanks Niall for the reference links. They were very much helpful

View solution in original post

3 Replies

Avatar

Level 10

Hi,

There is a discussion here: http://forums.adobe.com/message/1360859#1360859 and I have uploaded Paul's solution here: https://acrobat.com/#d=5gQoNybe75bwACDtfBToMA.

This might help you.

If you want the user to be able to attach files to the form, then it would need to be Reader Enabled using LC Reader Extensions, which is part of the server solution. See summary here: http://assure.ly/etkFNU.

Also this example might help: http://assure.ly/vRyoeQ.

Hope that helps,

Niall

Avatar

Level 2

Niall, thanks for the reply. This URL http://assure.ly/vRyoeQ was helpful, but it is not working for any type of file. My PDF might have any kind of attached document say a simple text or word document or excel or a PDF. The code help in that URL is not working for my scenario. FYI, I displayed the file name in a table row and wrote the relevant code in the "click" event of that particular filename and I am getting 'Invalid argument type' TypeError for the cName argument.

Avatar

Correct answer by
Level 2

Hi Niall and everyone,

I was able to solve the issue. I displayed all the attached files name in a table in my form and used myDoc.dataObjects to get the attached files and used row index of that particular filename in the table data to open the particular file. For opening the file, as usual I used the exportDataObject.

If anyone want the code reference, this is my mailid: sujaikareik@gmail.com. Once again, thanks Niall for the reference links. They were very much helpful