OmniJS - Document properties help

Is there a way to specify the document properties for:

Ruler Units: (Inches or Pixels)
Orientation: (Landscape, Portrait)
Size: (Fixed 1pg x 1pg)

I found where I can specify “Fixed” for size but no ability to specify the size itself? Maybe its just the documentation.

My code handles layout in pixels but my addCanvas() calls default to inches for ruler units and I can’t seem to find any way to force it. Right now I am using straight JS in the automation console and not via the Apple utility.

Thanks for any help here!


Most of these are set for the canvas per the API reference:
var canvasSizeIsMeasuredInPages → Boolean
var horizontalPages → Number
var verticalPages → Number

You want canvasSizeIsMeasureinPages to be set to True. If you also have horizontalPages == 1 as well as verticalPages == 1 , you should get the canvas size that you want in points. There is no option to specify a size that isn’t in points currently, from what I can tell.

Keep in mind the page size is based on your page setup by default which uses your default printer settings when creating a new document. There is a Canvas Tools plug-in which might help with examples to check against for specifying size at

Per all sizes are expressed in points. If you want to convert to a different measurement it might be easiest as a workaround to use a built in template that has the scale that you want as a reference to add canvases to until the ability to use other measurements is possible with JavaScript.

Being able to set the units and scale is a useful suggestion. Please drop us an email at to make sure the request to add the ability to specify units of measurement and scale via scripting is tracked correctly.


1 Like

Thanks Lanette! My apologies for missing the horizontalPages/verticalPages property. This is exactly what I needed. That said, I tried it and my new canvases are all still being created with an “infinite” sizing mode. My code is as follows:

    var currentCanvas = addCanvas(); = "Page " + pageNumber;
currentCanvas.canvasSizeIsMeasuredInPages = true;
currentCanvas.CanvasSizingMode = CanvasSizingMode.Fixed;
currentCanvas.horizontalPages == 1;
currentCanvas.verticalPages == 1;

Can you advise on what I am doing wrong? Thanks…Robert

It seems I’ve misunderstood. I’m a student in JavaScript, and I still have much more to learn. I can only read the Canvas Sizing Mode at the canvas level, so the script needs to go up to the Document level to change it.

var Fixed → CanvasSizingMode read-only

Try this example which works from the Document level instead:

    	cnvs =[0].selection.canvas = "Page"
    	cnvs.canvasSizingMode = CanvasSizingMode.Fixed
        cnvs.size = new Size(20,10)
        cnvs.canvasSizeIsMeasuredInPages = true
        cnvs.horizontalPages == 1
        cnvs.verticalPages == 1


1 Like

Are you sure that you want == (equality test with type coercion) there ?
(it gives you an expression which evaluates to a boolean)

Not the assignment operator = ?

(cnvs.horizontalPages etc)

Please let us know what you learn from your tests. Thanks!

draft8, thanks for this and I believe you are right in that I made a mistake on not assigning the value versus evaluating equality. I modified those lines to correct the error and tested again.

I also added the cnvs.size = (x,y) line which seems to have helped. Ironically, I had to comment out the “canvas.CanvasSizeIsMeasuredInPages = true” line to get it to stop adding the 4 sheets, but that did work. It’s on one, landscape orientation, sheet now. Not exactly elegant, but it did achieve a close outcome to the goal. Things are a little off-center and will need to be cleaned up, but the effort savings of the automation makes that nothing to complain about.

Thanks so much for the help!


1 Like