• 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 show number in inches

Participant ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

I created a field to enter a number like this, 1 5/8 or 1 7/8 to 2 7/8 etc. I would like to not have to type in the " mark every time. I have this javascript that does what I want, but to whole numbers not fractions. Take a look a this script and perhaps it can be modified to get the job done.

my code (in the Custom Format)

AFNumber_Format(0,0,0,0,"\''",false);

I''ve tried to play around with it a little bit but couldn't get it. If you know, please let me know? Thanks.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

386

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

correct answers 1 Correct answer

Community Expert , Mar 01, 2019 Mar 01, 2019

So, "5/8" is not a number, it's text, so you have to use text formatting. As it turns out this is extremely easy.

Use this as a custom format script.

if(event.value.length)

    event.value += "\"";

Votes

Translate

Translate
Community Expert ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

So, "5/8" is not a number, it's text, so you have to use text formatting. As it turns out this is extremely easy.

Use this as a custom format script.

if(event.value.length)

    event.value += "\"";

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

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
Participant ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

hi Thom, that was fast. Thank you. That's what I wanted.

I also wanted to talk to you about your stamp book. I'm playing around with them and have successfully made some. They're simple static ones though. But, I'd like to create the dynamic types. Does your book show how to create them? I mean like the source code and examples? I've seen these stamps (I think they were stamps) on the internet where there's an interface that have drop downs and can import info from Excel spreadsheets and all kinds of neat things. Does your book go into this kinds of advanced scripting? Would you have any other examples other than your short demo video on your site? I'd like to really spend more time checking it out.

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 ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

LATEST

Yes the book covers many advanced scripting techniques for Dynamic stamps, that was kinda the point. You'll also find more info and examples at www.pdfscripting.com.

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

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