Skip to main content
Inspiring
November 8, 2014
Question

Insert Page number tag

  • November 8, 2014
  • 2 replies
  • 562 views

Hi All

For e-pub I need to inset page number tag like (<?new-page 7?>) end of every page using indesign script + xml workflow.

Could you please help me.

This topic has been closed for replies.

2 replies

R-Bala-Krishnan
Inspiring
December 10, 2014

For XML workflow:

  var target_fr = myDoc.xmlElements[0].insertionPoints[-1].parentTextFrames[0];   

  do{

      num = target_fr.parentPage.name;

      if (num_pre != num){

          target_fr.insertionPoints[0].associatedXMLElements[0].xmlInstructions.add({target:'new-page', data:num,  storyOffset:target_fr.insertionPoints[0]});

          }

      num_pre = num;

      target_fr = target_fr.previousTextFrame;

      }while(target_fr.parentPage.name!=myDoc.pages[0].name);

Regards, Bala

Inspiring
December 9, 2014

var myf=Folder.selectDialog("Choose folder for Application File");

if (myf != null)

{

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

    var myfile=myf.getFiles("*.indd");

    var a = myfile.length;

    for (var i=0; i<myfile.length;i++)

    {

        var cur_doc=app.open(File(myfile,false));

        var x = cur_doc.name;

        var y= cur_doc.filePath+"";

        var myname=x.replace("indd", "epub");

        var mypath=myf+"/"+myname;

        for (nPg=cur_doc.pages.length-1;nPg>=0;nPg--)

        {

           if (cur_doc.pages[nPg].textFrames.length!=0)

           {

            app.select(cur_doc.pages[nPg].textFrames[0].insertionPoints[0]);

            app.selection[0].contents="<?new-page "+cur_doc.pages[nPg].name+"?>";

            }

        }

        //cur_doc.exportFile(ExportFormat.epub, File(mypath))

        //cur_doc.close(SaveOptions.NO)

    }

}

alert("Process Completed")