Skip to main content
Participant
May 4, 2009
Question

[js] PageOrientation in documentPreferences

  • May 4, 2009
  • 2 replies
  • 1709 views

Hi All,

   I have an InDesign document where the width is 14in and the height is 11in.  The pageOrientation is set to landscape.  I have a Javascript where I am creating the document preset for this particular document.  The problem lies in the value that is retrieved for the pageOrientation for this document.  For some reason, the value retrieved from "app.activeDocument.documentPreferences.pageOrientation" is PORTRAIT and not LANDSCAPE.   This doesn't make sense when the document setup through InDesign (desktop) clearly states the pageOrientation is set to landscape.  All other "documentPreferences" settings look fine in the JavaScript

Thanks for your help!

-Jennifer

This topic has been closed for replies.

2 replies

Known Participant
May 6, 2009

Have you tried this setting:

app.documentPreferences.pageOrientation = 2003395685;

I use, among other settings, in my startup script:

app.documentPreferences.pageSize = 'A4'; // The size of the page.
//app.documentPreferences.pageOrientation = 2003395685; // The page orientation. 2003395685 = 'wide'
app.documentPreferences.pageOrientation = 1751738216; // The page orientation. 1751738216 = 'high'

Hope this helps ...

--

molsted

May 6, 2009

Hi Jen,

Could you try running this script?

var myPageOrientation = app.documents.item(0).documentPreferences.pageOrientation;
switch(myPageOrientation){
case PageOrientation.portrait:
  alert("Page Orientation: Portrait");
  break;
case PageOrientation.landscape:
  alert("Page Orientation: Landscape");
  break;
default:
  alert("Unknown Page Orientation");
  break;
}

If it reports that the orientation is other than what you see in the user interface, I'd try exporting the file to IDML and then opening the IDML file. If the file was converted from another application, or even from another version of InDesign, this should clear up the problem.

Thanks,

Ole

Participant
May 7, 2009

Hi Ole,

     Thanks for your reply!    Your suggestion worked with CS4!    I'm curious as to why that worked....

Jen

May 4, 2009

Hi Jenni,

Your code shows perfect landscape value "alert(app.activeDocument.documentPreferences.pageOrientation);" . Is it problem with document or script?

Regards,

sudar

Participant
May 4, 2009

Sudar,

   No, the script shows PORTRAIT when I do an "alert (app.activeDocument.documentPreferences.pageOrientaion)" even though the document setup is "landscape" in InDesign.  Do you have any ideas?

Thanks,

Jen

May 6, 2009

Hi Jen,

Im working with CS3 / Javascript / Windows XP, What about you?

regards,

sudar