Page 1 of 1

How to delete pages 2 pages before last page?

Posted: Thu Mar 23, 2017 7:37 pm
by bernard meunier
Hi,
I'm asking myself either or not it is possible to create a script so that to silently
remove 2 pages before the last page of a lot of documents at time?
(I do drop the "delete pages" action but you have to specify the range
from start! I guess entering 2-3 will delete second and third pages from
start... I'm looking for the same but from last)
Regards,
Bernie

Re: How to delete pages 2 pages before last page?

Posted: Thu Mar 23, 2017 8:39 pm
by Willy Van Nuffel
Nothing more but an idea... Doing the job in three steps:

1) Split/Merge all pages in reverse order

2) Delete pages 2-3

3) Split/Merge all pages in reverse order

Re: How to delete pages 2 pages before last page?

Posted: Thu Mar 23, 2017 9:54 pm
by Patrick-Tracker Supp
Hello,

Thank you for your post. This should be fairly easy to do using a JavaScript such as below:

Code: Select all

this.deletePages({nStart: this.numPages - 3, nEnd: this.numPages - 2});
You can activate the JavaScript console by using [Ctrl]+[J].
I hope this helps!

Re: How to delete pages 2 pages before last page?

Posted: Fri Mar 24, 2017 6:05 pm
by bernard meunier
Hi,

I will try Willy's idea which should allow doing a "black Box" PDF tools icon on the desktop. (Thanks Willy).
I will keep Patrick's answer ... which will be useful to create a script which can be attached to
an icon in PDF Editor. (Thanks Patrick).

Regards
Bernie

Re: How to delete pages 2 pages before last page?

Posted: Fri Mar 24, 2017 8:07 pm
by Patrick-Tracker Supp
Anytime :)

Re: How to delete pages 2 pages before last page?

Posted: Fri Mar 24, 2017 8:29 pm
by bernard meunier
Here is result:

function DeletePageBeforeLast()
{
this.deletePages(this.numPages - 3, this.numPages - 2);
}

app.addToolButton({
cName: "Delete Page Before Last",
cExec: "DeletePageBeforeLast()",
cTooltext: "Delete 2pages before end of doc",
cEnable: true,
nPos: 0
});

Following Willy's instructions (Thanks)
I did create the javascripts manually in PDF Edition installation folder
C:\Apl\Tracker Software\PDF Editor\Javascripts
And dropped the file.js in it to get desired button.

BTW the PDF tools script as well works... but javascript perform faster!

Regards
Bernie

Re: How to delete pages 2 pages before last page?

Posted: Sat Mar 25, 2017 8:56 pm
by Will - Tracker Supp
Thanks Bernard, much appreciated! :)