4 Replies Latest reply on Nov 22, 2011 7:02 PM by stealthrs

    Keeping Track of Pages to Print?

    stealthrs Level 1

      Hi guys,  I'm in finance and whenever I have a new client, I have to fill out about 70-90 pages of paperwork per client (depending on what needs to be done for them).  I went from knowing NOTHING about Acrobat and PDFs to having all of my documents together in one file and auto-populating redundant fields and questions...

       

      There's about 90 pages in one PDF file, some pages are needed and some aren't.... What is the best way to track what needs to be printed?

       

      Normally I'm able to figure out what needs to be printed based upon certain questions that are answered with Checkboxes.  For example: Is the client a Pilot?  If I check yes, then I need to print a whole new page called an Aviation Supplement.

       

      What I'm currently trying to do and I don't know how to code it (It's easy to do, but I can't figure out how to use JavaScript fully): When I check the box 'yes' for the pilot question, I have the first page of the PDF a blank page that says what page numbers need to be printed.... If the box is checked yes (named: chkbx_pilot), I would like the page number of the Additional Form that needs to be printed to show up in a text box on page #1 (txtbx_pagestoprint)....  If I have another form that needs printing and check yes (chkbx_racecardriver), I would like it to tell the page number to txtbx_pagestoprint too...  So I see Page 28 and 29 need to be printed now!  Then I'll click File > Print then manually type in the numbers to print off....

       

      I've considered just having the answer of a checkbox determine of a text field hides or unhides to make it easy, but I can't even figure that out.

       

      Are these dumb ideas?  Is there a better way?  How the heck do I do this?  Can anyone give me some guidance?

        • 1. Re: Keeping Track of Pages to Print?
          BarlaeDC Level 4

          Hi,

           

          There are a couple of ways to approach this, although if you would like to do it in one textfield in the document you could add a script like this to each checkbox you want to have include pages for print. I would use the Mouse Up event ( but that is just personal prefernce)

           

          // assuming you print pages textfield is called "pagesToPrint" the script would be something like

          // script start

          // get the text field

          var printField = this.getField ("pagesToPrint");

          // this variable would change for each check box to the pages you want printed.

          var pagesToPrint = "28-32";

           

          // check if the field is empty

          if ( printField.value == "")

          {

           

               printField.value = pagesToPrint;

          }

          else

          {

               // as printField has a value, add the new pages to the end of the value

               printField.value = printField.value + " - " + pagesToPrint;

          }

          // script end

           

          Sample document with the idea here  ( this is just a quick knocked together sample to give you an idea) - https://acrobat.com/#d=yjRvsyKc4V4axtVcUy9R5w

           

          Hope this helps

          • 2. Re: Keeping Track of Pages to Print?
            stealthrs Level 1

            We're on the right path!! Is there a way to get the page number to unlist from the text box when I uncheck the box/check another box that's named the same but has a different Export value?  With that code there's a duplication issue... Checking it puts it in, unchecking it puts it in too.

             

            If the answer is yes, put the page number to be printed in the textbox... If it's no - unlist it!  That sort of thing.  Here's basically my format, please click the link.

             

            https://acrobat.com/#d=jLNFkYG9CwAQGTm8S*48MA

             

            Thanks for your work my friend!  You've already saved me hours.

            • 3. Re: Keeping Track of Pages to Print?
              BarlaeDC Level 4

              Hi,

               

              I have taken you sample and made it do something close to what I think you would like.

               

              I have created a document level JavaScript function ( this means that each checkbox can call the same function and it does the same thing, eliminating possible errors in code.

              (if you need help for how to view a document JavaScript, either check the help for the version of Acrobat you are using ( as it moves depending on the version) or post here and we can point you in the right direction)

               

              I have added the code to the yes and no checkboxes so that the numbers are added and removed from the text box. I have also added radio buttons for each selection, the reason for this is that a radio button can only be one value ( either Yes or No) and this means that you couldn't have possible issues with having Yes and No checked at the same time.

               

              The new file is here https://acrobat.com/#d=TFPYllNsn7l8EvxMH*rC6g.

               

              Let me know if you have any questions

               

              Malcolm

              • 4. Re: Keeping Track of Pages to Print?
                stealthrs Level 1

                Thanks for the help, but this is what I ended up with and it worked PERFECTLY... It doesn't duplicate and it works 100% of the time with the correct formatting (spaces and commas)

                 

                 

                // script start

                 

                //get the button

                var btn = this.getField("chkbox_lifeapp");

                //app.alert("value = "+btn.value);

                 

                 

                // this variable would change for each check box to the pages you want printed.

                var apppagestoprint = "2-11";

                 

                 

                //check value of checkbox

                if(btn.value=="Yes") {

                    var action = "add";

                }

                else

                {

                    var action = "";

                }

                 

                updateapppagestoprint(apppagestoprint, action);

                 

                 

                function updateapppagestoprint(apppagestoprint, action) {

                    //app.alert(apppagestoprint + " :: " + action);

                 

                    // get the text field

                    var printField = this.getField("apppagestoprint");

                 

                    if(action=="add")

                    {

                        // check if the field is empty

                        if ( printField.value == "" || printField.value == " ")

                        {   

                             printField.value = apppagestoprint;

                        }

                        else

                        {

                             // as printField has a value, add the new pages to the end of the value

                             printField.value = printField.value + ", " + apppagestoprint;

                        }

                    }

                    else

                    {

                        printField.value = printField.value.replace(apppagestoprint+", ", "");

                        printField.value = printField.value.replace(apppagestoprint, "");

                        printField.value = printField.value.replace(/^,|^, |, $|,$/, "");

                    }

                 

                }

                 

                 

                // script end