3 Replies Latest reply on Oct 25, 2012 11:52 AM by PJLeveno

    How to give Page break in XML

    Nishatry Level 1

      Can we give an page break instructions through XML file.

      I have an xml file which i am importing and generating pdf.Is there any tag or paragrapg style that can be applied to xml element to indicate page break.

        • 1. Re: How to give Page break in XML
          Techi Panda Level 2

          Hi Nishatry

           

          I dont think so there is one command for pagebreaking from indesign. By this way you can try create tag for pagebreaking and apply a paragraph style then simply replace the pagebreak style to pagebreak

           

          app.findTextPreferences = app.changeTextPreferences = null;
          app.findTextPreferences.appliedParagraphStyle = "Pagebreak";
          app.changeTextPreferences.changeTo = "^P";
          app.activeDocument.changeText();

           

          thanks

           

          regards

          a r u l

          • 2. Re: How to give Page break in XML
            ramkumar.vp Level 3

            Hi Nishatry,


            You cannot add the Page break as a symbol in XML. Instead you can add element or attribute as "PageBreak".


            In InDesign scripting you can find the "PageBreak" elements and insert the pagebreaks by using the following code.


            var myDoc = app.activeDocument;

            PageBreaking(myDoc);

            alert("Page Break Inserted");

             

            function PageBreaking(elm){

                for (var i = 0; i < elm.xmlElements.length; i++){

                    try{

                        XMLelementName=elm.xmlElements[i].markupTag.name.toString();

                        elm.xmlElements[i].select();

                        if(XMLelementName=="PageBreak"){

                            elm.xmlElements[i].contents = SpecialCharacters.frameBreak;

                        }

                    }catch(e){}

                    PageBreaking(elm.xmlElements[i]);

                }

            }

             

            I think this is usefull for your requirement.


            Regards,

            Ramkumar .P

            1 person found this helpful
            • 3. Re: How to give Page break in XML
              PJLeveno Level 1

              Hi! I think you guys are solving a problem I have. I have almost no knowledge of scripting, so bear with me please. It seems to me that if I introduce an element named PageBreak into the XML and then import the XML into indesign CS5, if I then run your script (what kind of script is this? apple, java, etc) then the script will find all PageBreak elements and replace with the frameBreak special character.

               

              Is this correct?

               

              If so, how do I introduce the element PageBreak? What should it look like in the XML document?

               

              Also, can I just copy and paste your script in the applescript editor and run it?

               

              Sorry for my lack of knowledge in this area. This is where I am starting, so I appreciate your help.

               

              Paul