4 Replies Latest reply on May 16, 2012 11:07 AM by [Jongware]

    How to delete empty pages in in-design document?

    Velprakash

      Hi All,

             How to delete empty page which may contains text frame with no contents, or may be no text frame...

      Plz provide me the script...

       

      Thanks in advance,

      Vel....

        • 1. Re: How to delete empty pages in in-design document?
          [Jongware] Most Valuable Participant

          What language? What version of ID? What have you tried so far, and where do you get stuck? 

           

          Do you need someone to write a script for you? Are you willing to pay for it?

          • 2. Re: How to delete empty pages in in-design document?
            Velprakash Level 1

            Indesign CS5.

            My script is,

            doc=app.activeDocument;

            pageObj=doc.pages.item(0);

            txtObj=pageObj.textFrames.item(0);

            var temp=doc.pages.length;

            for(var i=0;i<temp;i++)

            {

                if(doc.pages[i].textFrames.item(0)!=null)

                {

                        if(doc.pages[i].textFrames[0].contents!=null) // here, i used "contents" instead of "lines". but also not working well...

                        {

                            alert(doc.pages[i].textFrames[0].contents);

                            alert("True");

                        }

                        else

                        {

                            doc.pages[i].remove();

                            i=i-1;

                            temp--;

                        }

                }

                else

                {

                  alert("False");

                  doc.pages[i].remove();

                  i=i-1;

                  temp--;

                }

            }

             

            I've a sample document which contains a empty page without a text frame and another empty page with text frame with no contents on it... but my script remove only the empty page and not the empty page with txt frame...

             

            pLZ HELP JONGWARE...

            • 3. Re: How to delete empty pages in in-design document?
              Velprakash Level 1

              Hi All,

              The correct script is as follows:

               

              doc=app.activeDocument;

              pageObj=doc.pages.item(0);

              txtObj=pageObj.textFrames.item(0);

              var temp=doc.pages.length;

              for(var i=0;i<temp;i++)

              {

                  if(doc.pages[i].textFrames.item(0)!=null)

                  {

                          if(doc.pages[i].textFrames[0].contents=="")

                          {

                              doc.pages[i].remove();

                              i=i-1;

                              temp--;

                          }

                          else

                          {

               

                          }

                  }

                  else

                  {

                    doc.pages[i].remove();

                    i=i-1;

                    temp--;

                  }

              }

               

              Thanks andRegards,

              Vel.

               

              Note Friends:

              Forum is for the clearance of doubt and the search of solution by the experts. But some people are looking for earning money. It's really *********...

              • 4. Re: How to delete empty pages in in-design document?
                [Jongware] Most Valuable Participant

                Gosh. How is one supposed to clear your doubts and provide a solution with the *extremely* minimal information you initially gave?

                 

                >Plz provide me the script...

                 

                Yeah, that was the line that suggested to me "Yo dudes, someone do the thinking for me as I don't want to!"