3 Replies Latest reply on Jan 8, 2013 1:21 PM by George_Johnson

    octal to binary in a PDF form


      I would like to insert a numeric dropdown into a PDF, where the user can select an octal value from 0 to 7. Then, an action script calls a JS function, like (OCT2BIN in Excel?) and the three digit binary conversion is exported to a seperate text box for the user to see.


      Could I use a text box that accepts valid octal numbers instead of the dropdown?


      I have Acrobat Pro X. Should I use LiveCycle Designer ES2 instead?


      I need to do this for an octal number that is 8 digits long:


         4    5     0     1     0     0     0     1

      100 101 000 001 000 000 000 001


      Any help is greatly appreciated.





        • 1. Re: octal to binary in a PDF form
          George_Johnson MVP & Adobe Community Professional

          Yes, you can do all of that and there would be no advantage to using Designer. You could create a simple function to convert a digit to the binary representation. If you need help with the scripting, post again.

          • 2. Re: octal to binary in a PDF form
            Rich79924 Level 1

            Yeah, I would definately need help with the scripting. JS insertion into a PDF is not my strong suit


            Looking back at it again, well, I guess I need to present the user with an empty eight position comb in a numeric box. The user inputs eight octal values and receives a 24 bit binary equivalent in a seperate box underneath the comb.


            The creation of a form like this would be nothing short of amazing in my line of work. I mean, I can chase binaries all day, but I have to pass the technique to youngsters that have never seen it before. A PDF works in their smartphone and if the device tells them what the binary is, they'll believe it.


            Thanks again Mr. Johnson,



            • 3. Re: octal to binary in a PDF form
              George_Johnson MVP & Adobe Community Professional

              Here's a quick & dirty sample that should get you started: https://workspaces.acrobat.com/?d=PNfGMfQ22gKjx1JIoPbLoQ


              There is a custom Keystroke script that calls a function in a document-level JavaScript that limits the octal field to valid digits, a custom Validate script that effectively removes leading zeroes in the octal field (kind of sloppy, but you're not paying me), another function in another document-level JavaScript that converts a string of valid octal digits to the binary representation, and a custom calculation script for the binary field. It's all pretty simple, but you will have to study all a bit to see how it works. This isn't necessarily the best way to do this, is pretty minimal, and you may want it to behave a bit differently, but it should get you started.