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

cSavepath not saving based on if then statements

Explorer ,
Jul 03, 2017 Jul 03, 2017

Copy link to clipboard

Copied

HI,

I am trying to make it so if the total number of pages (numPages) is 1, then the code inserts the "1" +  "page" and if there is a total of 3 pages , it would insert save as "3" + "pages".  I don't understand why the following is not saving the pdf with the cSavePath (i.e., filename) based on whether the total # of pages is 1 or not 1:

        cSavePath += " - "

        cSavePath += event.target.numPages

        If (event.target.numPages == "1")

       {cSavePath += " page"}

        

        If (event.target.numPages != "1")

        {cSavePath += " pages"}

    

I even tried as numerical value:

cSavePath += " - "

        cSavePath += event.target.numPages

        If (event.target.numPages = 1)

       {cSavePath += " page"}

        

        If (event.target.numPages > 1)

        {cSavePath += " pages"}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

500

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 , Jul 04, 2017 Jul 04, 2017

Also, it's "if", not "If"...

Votes

Translate

Translate
Community Expert ,
Jul 03, 2017 Jul 03, 2017

Copy link to clipboard

Copied

Use == not = for the comparsion.

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 ,
Jul 04, 2017 Jul 04, 2017

Copy link to clipboard

Copied

Also, it's "if", not "If"...

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
Explorer ,
Jul 04, 2017 Jul 04, 2017

Copy link to clipboard

Copied

LATEST

Ughh, yes.  It was the "If" vs. the "if".  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