Expand my Community achievements bar.

Include a link to attached files: is it possible?

Avatar

Level 1

Hi all,

I have a problem I hope you can help me with.

When using Acrobat,Pro you can add attachments to a PDF file and include a link in the PDF file to this attachment. As a result, if you click on the link, the attachment will open in a new window.

Now, I have created a form in LiveCycle Designer, and on the bottom of the form I would like to include a link to an attached file. However, it seems that I cannot edit the newly created form in Acrobat Pro. Hence, I am not able to include a link to the attached file using the method described above.

I cannot find an option to attach files in LiveCycle Designer, nor a way to link to an attachment. Am I overlooking something, or is it just not possible to include a link to an attachment in a form created in LiveCycle Designer?

Many thanks in advance for your reply!

13 Replies

Avatar

Level 4

I do not think that is an option. Livecycle would not know that the form is attached within the PDF as attachments are in Acrobat; not Livecycle. If you want that kind of functions you would have to create the form in Acrobat.

Avatar

Level 1

Hi Josh,

Thanks for your reply. I have recreated the form in Acrobat and got things working the way I wanted. Problem solved.

Avatar

Level 10

Hi,

I guess it is too late now, but you can do this in a LiveCycle Designer form.  Just the same as an Acrobat form, except you refer to the Doc object as event.target.  So to attach a file use this JavaScript;

if (event.target.importDataObject("MyAttachedFile"))

{

    var attachmentObject = event.target.getDataObject("MyAttachedFile");

    console.println("Attachment path="+attachmentObject.path);

}

And, this will open it.

event.target.exportDataObject({ cName: "MyAttachedFile", nLaunch: 2 });

Bruce

Avatar

Level 4

Bruce:

I believe this is sufficient related to avoid a new thread. Is it possible to open a pdf attachment (using your methods above) but with a twist? Open the document and move to a specific bookmark in the pdf?

Avatar

Level 10

Hi,

I don't think so.  You can set a PDF document to open at a particular page when you create it, but I guess you want something dynamic.  If the PDF was available on the web you could open it at a specific bookmark using a nameddest=name query string parameter and the app.launchURL() method.

Regards

Bruce

Avatar

Former Community Member

Hi Bruce,

A few years ago (2013), you posted a possible solution to the problem of providing a link for users to attach files to a PDF created in LiveCycle Designer. Now in 2018, this still seems to be a problem and you were the only person who seemed to offer a solution. I copied your script and placed it in the Script Editor as follows:

if (event.target.importDataObject("MyAttachedFile"))
{
    var attachmentObject = event.target.getDataObject("MyAttachedFile");
    console.println("Attachment path="+attachmentObject.path);
}
event.target.exportDataObject({ cName: "MyAttachedFile", nLaunch: 2 });

However, it seems to work only if someone's using Adobe Acrobat but it doesn't work with Adobe Reader which most users have.

I'm wondering if there's something I'm missing (I'm a novice user of JavaScript and LiveCycle Designer) or if there's something I need to modify in the script.

Thanks very much.

MJ

Avatar

Level 10

Hi MJ,

You will have to 'Reader Extend' the form to allow Reader to add attachments, there's a good summary of all this in one of Niall's blogs

Using LiveCycle Forms in Acrobat and Reader | Assure Dynamics developing dynamic LiveCycle and Flex ...

Bruce

Avatar

Former Community Member

Hi Bruce,

Thank you for replying - good to know that you're still online after all. Yes, actually I had saved the LCD form (using Acrobat DC) as a Reader Extended PDF (Enable More Tools, includes form fill & Save). Below is a dropbox link to the form:

Dropbox - ReaderExtendedTest.pdf

Thanks again,

MJ

Avatar

Level 6

When you Reader-enable with Acrobat, it does not include the usage right that allows Reader to add file attachments. Reader does allow user to add attachments as comments, and it can be done via JavaScript, but not with a dynamic XFA form.

Avatar

Former Community Member

Hi George,

Thanks a lot for your reply. It confirms what I've grasped from a number of posts: LCD will produce dynamic PDFs but can't enable file attachments. Adobe Acrobat can enable file attachments but doesn't have the functionality to produce dynamic PDFs - and unfortunately, can't be used to edit forms created with LCD. Just another way that Adobe manipulates the need to purchase its products.

Regards,

MJ

Avatar

Level 6

Acrobat can't enable normal file attachments. It can enable commenting, thus allowing Reader to attach files as comments, which is a manual process. This process can be initiated via JavaScript, but the user still has to navigate and select the file to be attached. LiveCycle Designer can create static forms which allow this with Reader.

Avatar

Former Community Member

Yes, you’re correct. Although, using LiveCycle to create static forms is not an option (for me).  I’d only use LiveCycle if the form needed some “dynamic” features and I use InDesign to create static forms.

Avatar

Level 4

Hi,

 

Just wondering if this is something others noticed. but when using the JavaScript approach to add attachments to a PDF, if I do one at a time save, exit and come back to add another. t

 

It only allows me one at a time, the first one gets corrupted somehow and disappears after I've added a second file and save.

 

As soon as i save after the second file is added, the first one changes names to "unknown" and disappears only leaving one file attached at a time. Can this be changed to allow multiple adds.??? 

 

I know that using the actual add attachment button in the attachment pane doesn't limit me to just one, only when i use the scripted method. Can this be over written somehow?

 

Thx

 

PAtrick