Button to attach then open a file.

New Here ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Hi,

 

So, I'm creating a fillable form PDF, and something I need to be able to do is have the user add attachments. I found some javascript that seems to do that fine, but it adds the attachments to the attachment list which is a bit inconvenient.

 

Once the button has been clicked and a file attached, I'd like to change what the button does, so that if you click it again, instead of prompting the user to pick another attachment, it opens the attachment previously added by that button, in the same way it would if you clicked the attachment in the attachment list (opening it in a new acrobat tab, allowing it to be filled out/manipulated as any other pdf is, then saved back to the first pdf as the same attachment).

 

Is it possible to make a button that can open an attachment like this, and if so, how? 

 

 

TOPICS
JavaScript , PDF forms

Views

51

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Depends. Does your code attach the file as a Data Object (a regular file attachment) or as a File Attachment comment? If the former, it might be possible. If the latter, it's not.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

It's using the cAttachmentPath property, so annotation I think. If I were to attach as a data object, how could I then open it?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Using the exportDataObject method.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Thanks, I'll give it a look. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Down-side of this method, though, is that files can't be attached like that in Reader...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

If they can't be attached as dataobjects in the reader then that'd be a problem. Can they be attached as annotations in reader?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

If they use Reader DC, yes.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

LATEST

Fantastic, thank you!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines