Skip to main content
Known Participant
January 13, 2017
Answered

Duplicate page

  • January 13, 2017
  • 2 replies
  • 4517 views

Hi!

I need to make an action which duplicates page 1, 8 times in a 3 page pdf. I have found some scripts, but I can’t make them work. Can someone help me with some java that will work with action wizard? ( I don’t know much about java scripting, normally I just copy/paste scripts.)

This topic has been closed for replies.
Correct answer try67

I would prefer not to duplicate the code 8 times... could you you ad the for-loop to the code?


Sure.

for (var i=1; i<=8; i++) {

    this.insertPages ({

        nPage: -1,

        cPath: this.path,

        nStart: 0

    });

}

2 replies

ILWTAuthor
Known Participant
January 16, 2017

Hi again.
Unfortunately, the script only worked twice. The third time I used it, it only made one page instead of 7. I adjusted the script a bit, but it still worked - well at least twice.

for (var i=1; i<=7; i++) { 

    this.insertPages ({  

        nPage: -1,  

        cPath: this.path,  

        nStart: 1  

    });  

try67
Community Expert
Community Expert
January 16, 2017

Why did you change the nStart parameter to 1? Do you want to duplicate the second page? If so, then you would need to adjust more things, because after the first run the second page is not the third, so you'll be duplicating the (previously) first page in the next iteration...

ILWTAuthor
Known Participant
January 16, 2017

Yes, it was the second page I needed to duplicate instead.
The strange thing is that the changed script works on a colleagues computer and at home, but not at work.
The script from friday (unchanged) is not working any longer. It's only making one copy of the first page.

try67
Community Expert
Community Expert
January 13, 2017

This code duplicates the first page. Run it 8 times to get 8 copies...

this.insertPages ({

    nPage: -1,

    cPath: this.path,

    nStart: 0

});

ILWTAuthor
Known Participant
January 13, 2017

Thanks
How do I set it to do it 8 times?

try67
Community Expert
Community Expert
January 13, 2017

Either duplicate the code eight times (ugly) or use a for-loop from 1 to 8

and put the code in it.

On Fri, Jan 13, 2017 at 3:43 PM, ingerlouiset <forums_noreply@adobe.com>