Search code examples
acrobat

ROunding to nearest .125 or 1/8 of a yard in Acrobat professional


I am trying to have a solution for a pdf figure out a equation and round up to the nearest 1/8th of a yard. The equation I am using that I want rounded is (Text17/15)+.25 How can I make that round up everytime?


Solution

  • Assuming that Text17 is a text field, containing a numeric value, and you always want to round up, you could put somehting like this into the Calculate event of the field which is supposed to show the result:

    event.value = util.printf("%.3f", Math.ceil(((this.getField("Text17").value*1 / 15) + 0.25) * 8) / 8 );
    

    And that should do it.