How to check a large canvas

Illustrator will automatically create an artboard on a large canvas
Dimensions in 1:10 scale

Simple solution

The app.activeDocument.scaleFactor attribute, which returns the scale factor, has been added to global document variables since CC 2020: 1 — normal canvas, 10 — large. We’ll use this factor to calculate the size of artboards, objects.

Checking the canvas mode and recalc the visible dimensions
var coeff = app.activeDocument.scaleFactor ? app.activeDocument.scaleFactor : 1;
var width = selection[0].width;
width *= coeff;

More info

New versions of Adobe Illustrator write a comment into the document structure containing the canvas scale value %AI24_LargeCanvasScale: 1 — normal canvas, 10 — large canvas. If there were no global variable, we could find the scaling factor this way. Notes:

  • the new document must be saved before running the script
function isLargeCnvs(doc) {
var $file = File(doc.fullName),
str = '';
$file.open('r');
while (!$file.eof) {
str = $file.readln();
if (/^%AI24_LargeCanvasScale/.test(str)) {
var ratio = (/\d+$/).exec(str)[0];
return ratio == '10';
}
}
$file.close();
return false;
}
var isLarge = isLargeCnvs(activeDocument);
var width = selection[0].width;
width *= isLarge ? 10 : 1;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
AiScripts

AiScripts

Sergey Osokin. I’m a illustrator & Script Developer (Ai, Ps). Writing about bugs and tricks.