Below is a script I wrote that isn't functioning properly on my large 200 page document that I need it to. Granted there might be a much easier way to script this, but I'm no expert. I have a 200 page document that needs to be 600 pages, basically every page needs to be copied twice (and obviously placed right after the original. So I have the original PDF, then I copied that PDF to use as a source document to copy from. (To clarify if I'm not being clear, the first 3 pages would be page 1, 2, 3,... it needs to be: 1,1,1,2,2,2,3,3,3 etc)
var targetpage = 0;
var sourcepage = 0;
while(sourcepage < 199)
{
this.insertPages({
nPage: targetpage,
cPath: "source.pdf",
nStart: sourcepage,
nEnd: sourcepage
});
targetpage++;
this.insertPages({
nPage: targetpage,
cPath: "source.pdf",
nStart: sourcepage,
nEnd: sourcepage
});;
sourcepage++;
targetpage=targetpage+2;
}
It gives me an error that I have no idea means, nor how to correct after only placing a total of 3 pages - so the doc went from 200 to 203 (2 of page 1 as intended, then 1 page of page 2, then for some reason it stops...
InvalidArgsError: Invalid arguments.
Doc.insertPages:9:Batch undefined:Exec
Why is it stopping? And please don't assume I know what I'm doing Thank you.