Copy link to clipboard
Copied
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.)
Sure.
for (var i=1; i<=8; i++) {
this.insertPages ({
nPage: -1,
cPath: this.path,
nStart: 0
});
}
Copy link to clipboard
Copied
This code duplicates the first page. Run it 8 times to get 8 copies...
this.insertPages ({
nPage: -1,
cPath: this.path,
nStart: 0
});
Copy link to clipboard
Copied
Thanks
How do I set it to do it 8 times?
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
I would prefer not to duplicate the code 8 times... could you you ad the for-loop to the code?
Copy link to clipboard
Copied
Sure.
for (var i=1; i<=8; i++) {
this.insertPages ({
nPage: -1,
cPath: this.path,
nStart: 0
});
}
Copy link to clipboard
Copied
Thank you SO much
Copy link to clipboard
Copied
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
});
}
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Are you sure you're executing the full code? You need to select it all before running it, if you're using the JS console.
Copy link to clipboard
Copied
Yes I am. I have tried it on several computers, Acrobat DC/XI. For some reason the script is not working on my work station, but on all my colleagues computers. I just have to run a modified script on my computer.
Copy link to clipboard
Copied
Are you getting any error messages on the console? What is the script you are running now (after making the adjustment for the now changing source page number)?
Copy link to clipboard
Copied
No error. It just duplicates page 2 one time and that's it.
This is the script:
for (var i=1; i<=7; i++) {
this.insertPages ({
nPage: 0,
cPath: this.path,
nStart: 1
});
}
Copy link to clipboard
Copied
I have now been working on a different document, with a slightly modified script. one page, duplicated 6 times (then the 6 pages are cropped into 6 different page sizes, haven't mentioned it before) and saved. Exactly like the 8 paged document, only this one was a native one paged document.
I ran it through several times, checking that the pages were cropped into the right sizes. Suddenly the same error: makes only one copy instead of 6 pages.
for (var i=1; i<=6; i++) {
this.insertPages ({
nPage: -1,
cPath: this.path,
nStart: 0
});
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now