These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Is this a bug or am I missing something???

robsox128
Registered: Apr 29 2009
Posts: 16

Hi,
I'm having problems changing page views back and forth from TwoPageRight to SinglePage. The following code works fine on all pages EXCEPT on page 5 (pageNum=4) where it displays the actual page 4 (pageNum=3). Am I missing something here??

this.layout = "SinglePage";
this.pageNum=4;

robsox128
Registered: Apr 29 2009
Posts: 16
Update, I've added an alert box to display the pageNum to make sure that wasn't the problem. The weird thing is that when the script executes, the correct number (4) is shown, and the correct page is shown (4). It is not until after the dialog is accepted that the doc jumps to pageNum=3.

There are no other scripts in this document.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
The pageNum property is 0-based, so if you are on page 4 pageNum is 3, not 4.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

robsox128
Registered: Apr 29 2009
Posts: 16
Thanks, yes I'm aware of the zero based page numbering, the problem is that it is not respecting it on the page being called i.e. if the button is on page 5 (pageNum=4), it is going to page 4 (pageNum=3) for some reason.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Paste the exact code you're using. Maybe that will help debug your problem.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

robsox128
Registered: Apr 29 2009
Posts: 16
Thanks try67 and sorry about the delayed reply. I have tried a number of things to get this to work and was trying to debug with the simplest possible script in a button which is this:

this.layout = "SinglePage";
this.pageNum=4;

My ultimate goal to to have a document script that would toggle the view but have had no success.

here is what I was working with, I can create a simple example pdf if that would be helpful:

function toggleZoom()
{
var docLayout = this.layout;

if (docLayout == "SinglePage")
{

this.layout ="TwoPageRight";
this.zoomType = zoomtype.fitW;
}
else
{

this.layout ="SinglePage";
this.zoomType = zoomtype.fitW;

}


}


Thanks again,
Rob
try67
Expert
Registered: Oct 30 2008
Posts: 2398
The script you posted works just fine for me (from the console).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

robsox128
Registered: Apr 29 2009
Posts: 16
Thanks, I've created a small (5 page) example pdf and uploaded it to http://www.robject.com/toggleTest2.pdf

I've added comments in the document script and the buttons themselves but in a nutshell, the toggleZoom function always returns the left facing page while the "this.pageNum=2;" works on all pages except "pageNum=2" which returns "this.pageNum=1;"

Thanks again for your help,
Rob