5 Replies Latest reply on Jun 18, 2012 5:54 AM by [Jongware]

    Page Range Validation

    TD_TAD

      Good Morning Friends,

       

      I have problem regarding Page range validation.

       

      I want to export all or selected pages as a pdf.

       

      And page range is comes from text file. for that i wrote script  as follows.

       

      with(app.pdfExportPreferences){

               pageRange = pageRangeFile.read ();

               pageRangeFile.close();

      }

       

      where pageRangeFile is simple text file i want to read page range from this file and export the selected pages.

      But if page range is not valid, it will export all pages.

           e.g my document contains 5 pages and i wrote 6 as page range

           it will export all pages, instead of doing this it will validate page range and export the valid pages only.

       

      instead of exporting all pages it should give an alert message that "page range is invalid".

       

      so if anyone know how to validate page range like "Export to Intractive PDF" indesign dialog please help me.

       

      Tahir. 

        • 1. Re: Page Range Validation
          [Jongware] Most Valuable Participant

          if ( pagerange > 5)

            alert ("page range is invalid");

          • 2. Re: Page Range Validation
            TD_TAD Level 1

            thanks Jongware for your Fast  response.

             

            it is just example that document contains 5 pages it may be extend 

             

            i want to validate input page range  similar to  Adobe Indesign "Export To Intractive PDF " dailog

             

            if document name may start with section prefix or starting range should be differnt.

             

            so considering all posibilities , i want to impliment this in my script.  

            • 3. Re: Page Range Validation
              Laubender Adobe Community Professional & MVP

              @Tahir – I think you have to build an array with all page names of the active document and compare that with your pageRangeFile to single out problems.

               

              How have you defined your pages in the pageRangeFile? Numbers or names? Do you use constructs like "4-9" (from x to y) or do you store the range in a format like "4,5,6,7,8,9"?

               

              Uwe

              • 4. Re: Page Range Validation
                TD_TAD Level 1

                i used combination of both numbers And Names

                e.g    my pagerange file contains  text as 1,3-4,5.

                • 5. Re: Page Range Validation
                  [Jongware] Most Valuable Participant

                  tahir1987 wrote:


                  i want to validate input page range similar to Adobe Indesign "Export To Intractive PDF " dailog if document name may start with section prefix or starting range should be differnt. [..]

                   

                  Okay, that's a bit more clear than your initial question. That's why my answer was deliberately doing exactly what you appeared to ask for.

                   

                  tahir1987 wrote:

                   

                  i used combination of both numbers And Names

                  e.g    my pagerange file contains  text as 1,3-4,5.

                   

                  Yeah. Can you also give a few examples of section prefixes and 'names' you are using? That numbering, is it Arabic only, or might it also include Roman (uppercase and lowercase) and/or Alphabetic? Because if so,

                   

                  considering all posibilities , i want to impliment this in my script.

                   

                  .. you picked up a substantial project. To be able to "validate a page range", which was your initial post, you need first to be able to correctly interpret "all posibilities" that a user can input. Probably, to be on the safe side, you'd also need to include checks for invalid ranges ("10-8") and invalid notation ("v-xiiii").

                   

                  As you may have understood by now, "validate page range" is not a built-in function of Javascript, a callable function of InDesign, or a simple function to write yourself. There is no simple solution to your request.