Skip to main content
Participating Frequently
Feb 3, 2021 11:37 AM UTC
Question

deletePages does not work in Adobe Reader

Hello all,

 

I am really new in that field so perhaps this is not a big deal for you but I am struggeling since a while.

 

I am trying to create a PDF using only templates which I let appear or disapear by pressing buttons (there is always only one active template). Using the following code it works perfectly fine in Acrobat DC Pro but when I open the same file in Acrobat Reader it is completely messed up (first page cannot be deleted-second templated appears but the buttons on that second page does not work correctly..). Perhaps someody knows what is wrong here.

 

var nNumRangee=1,bRetour=0,prevA=[];
function navigation(e){
this.delay=!0;
var t=this.dirty;
prevA.push(e),
isNaN(Number(e))||(this.getTemplate(e).spawn({bRename:!1,nPage:0,bOverlay:!1}),
this.numPages>1&&this.deletePages({nStart:1,nEnd:this.numPages-1})),
this.delay=!1,
this.dirty=t,
bRetour=1}

I hope you can help.

This topic is closed to new replies. Start a new post to keep the conversation going.

25 replies

Participating Frequently
Feb 3, 2021 1:00 PM UTC

Ok-update.

The adding of new pages does work now. However, they got not deleted.. This means when I add template 2 there are two templates (1&2) instead of only the second..

 

The code looks now as follows:

 

function navigation(e){
this.delay=0;
var t=this.dirty;
isNaN(Number(e))||(this.getTemplate(e).spawn({bRename:!1,nPage:0,bOverlay:!1}),
this.numPages>1&&this.deletePages({nStart:1,nEnd:this.numPages-1})),
this.delay=!1,
this.dirty=t}

Translate
try67
Community Expert
Community Expert
Feb 3, 2021 1:12 PM UTC

Your code is barely readable. Why use !0 instead of true and !1 instead of false? It's just plain confusing...

Translate
Participating Frequently
Feb 3, 2021 1:39 PM UTC

I did it differently - please have a look here:

 

function navigation(e){
this.delay=0;
var t=this.dirty;
if(isNaN(Number(e))=== false){
this.getTemplate(e).spawn({bRename:0,nPage:0,bOverlay:0})
if(this.numPages>1){
this.deletePages({nStart:1,nEnd:this.numPages-1})
}
}
this.delay=0,
this.dirty=t
}

Translate