• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to "count" number of attachments to .PDF and return total to form field?

New Here ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

I want to attach files to a PDF document using a "attach files" button (script works fine—all is well on this end).

 

Once files are attached, I would like a total of files attached to show in a form field on the PDF itself. So if there are two files attached, then the field reads "2". If there is one, then the field reads "1".

 

Thank you in advance!

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms

Views

464

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 ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

Are you attaching the files as comments or as data objects?

Votes

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 ,
Aug 22, 2024 Aug 22, 2024

Copy link to clipboard

Copied

Hi, I have the same request 4 years later : )

Attachments are added via

this.importDataObject command.

Thank you in advance again!

Votes

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 ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

In that case you can use the dataObjects array to know how many attachments there are:

app.alert("There are " + (this.dataObjects==null ? 0 : this.dataObjects.length) + " attachments in this file.",3);

Votes

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 ,
Aug 30, 2024 Aug 30, 2024

Copy link to clipboard

Copied

LATEST

Hey, I ended up not using it, but this was a helpful answer nonetheless! Thx!

Votes

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