Skip to main content
Participating Frequently
February 3, 2021
Question

deletePages does not work in Adobe Reader

  • February 3, 2021
  • 1 reply
  • 1367 views

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 has been closed for replies.

1 reply

Participating Frequently
February 3, 2021

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}

try67
Community Expert
Community Expert
February 3, 2021

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

Participating Frequently
February 3, 2021

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
}