Skip to main content
Inspiring
July 13, 2022
Answered

How to set ruler 0 point to canvas?

  • July 13, 2022
  • 1 reply
  • 1471 views

 

Hi,

Using Javascript, how to set the ruler origin to top left canvas corner point?

 

 

What is the official name for the area outside an artboard? Is it canvas, workspace, workarea, pastboard, ...?

Where is located it in the DOM? 

 

Thank you.

 

This topic has been closed for replies.
Correct answer femkeblanco

I don't know if it's official (it's not in my Using Adobe Illustrator guide), but I've seen it called pasteboard.  As it happens, I believe @CarlosCanto answered the same question yesterday.  See here.

1 reply

femkeblanco
femkeblancoCorrect answer
Legend
July 13, 2022

I don't know if it's official (it's not in my Using Adobe Illustrator guide), but I've seen it called pasteboard.  As it happens, I believe @CarlosCanto answered the same question yesterday.  See here.

tmmlsAuthor
Inspiring
July 13, 2022

Thank you for sharing this info. This was very usefull. 

 

I did some small adjustments. Below my working code...

 

 

 

var myDoc = app.activeDocument;

var dim = getLargestBounds(); 

myDoc.rulerOrigin = [dim[0],dim[1]+myDoc.height];


function getLargestBounds() {  
    var tempLayer, tempText, left, top, LARGEST_SIZE = 16383;  

    tempLayer = app.activeDocument.layers.add();  
    tempText = tempLayer.textFrames.add();  

    left = tempText.matrix.mValueTX;  
    top = tempText.matrix.mValueTY;  

    tempLayer.remove();  

    var dimensions = [left, top, left + LARGEST_SIZE, top + LARGEST_SIZE ];

    return dimensions;
}  

 

 



renél80416020
Inspiring
July 15, 2022

I'm going to jump in here and say I'd like to be able to set the origin [0,0] to any point I select. Repeatedly, in the same doc. I'm not a good scripter and gave up on this some time ago. It would run once, then not again until I quit Illy - not a solution!


Hi Met1

Sélectionnez un point sur un tracé existant.

// JavaScript Document for Illustrator
// De elleere
function main() {
  if (!selection.length) {return;}
  if (selection[0].typename != "PathItem") {return;}
    var idoc = app.activeDocument;
    var item = selection[0];
    var ptSel = item.selectedPathPoints;
    var r, pt;
      for (var i = 0; i < ptSel.length; i++) {
        var pt = ptSel[i];
          if (pt.selected == PathPointSelection.ANCHORPOINT) {
            r = i;
            break;
          }
      }
      if (r != undefined) {
         idoc.rulerOrigin = [0,0];
         idoc.rulerOrigin = pt.anchor;
      }
      else {beep();}
}
if (app.documents.length) main();

de elleere, pour vous servir...