Skip to main content
Inspiring
February 20, 2020
질문

Calculate a price with a percentage field in Acrobat

  • February 20, 2020
  • 1 답변
  • 1410 조회

 

Hi to all, 

it's my first time in fields calculation in PDFs, after several decades in usual printing files… So, I don't know where to start from. Be kind 🙂

 

I have four fields.

First, is the number of items I can buy, field name is Q.tà.

Second, the price of the item, field name is Prezzo.

Third, the discount amount in percentage, field name is Sconto.

And this field should be a little weird.

Because sometimes we have discounts, and sometimes not.

If I set this field as a percentage (property > tab format, maybe, don't know for sure, I use the Italian os), Acrobat automatically insert a "0.00%" text/value in the field, but I would not this, i would prefer an empty field. 

Fourth and last is the total (Totale) field, showing the amount of the items x price - discount % (if we have one).

 

Something like this: (Item) 10 x (Price) 100$ - (Discount - if we have) 25% = (Total) 750$

Can someone helps me with the formula?

 

Thank you, have a nice day, bye!

이 주제는 답변이 닫혔습니다.

1 답변

try67
Community Expert
Community Expert
February 20, 2020

A field set as Percentage can't be empty.

 

For setting up calculations see: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Astarte01작성자
Inspiring
February 20, 2020

Hi,

sad to know that the percentage field can't be empty. Maybe we can make it works with 0% when we will have no discounts, but it's very ugly to see…

I've seen that page when I'm looking for answers, but Javascript is so far beyond my abilites…

I'll check with a programmer tomorrow, hope he can help me…

 

Thank you for your help, have a nice day, bye!

 

Thom Parker
Community Expert
Community Expert
February 21, 2020

All of the built-in formatting options have issues of one type or another. But you can solve this problem with a custom format script.

Here's a tutorial with a sample file:

https://acrobatusers.com/tutorials/formatting_text_fields/

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often