Copy link to clipboard
Copied
Just installed our new PC and got Illy 2018 ( we have 2014 on the previous machine ).
We have a script that creates a document and then crops it to the visibleBounds rectangle.
That worked just fine in Illustrator 2014 but in 2018 instead of returning the real visual bound - it rather seems to return the Artboard bound of the document
I suspect there is a chance my approach may have been wrong at the first place but it worked before (by luck?).
Can someone please tell me how to deal with it ?
( I installed the 2014 on the new machine but now I am back to the dreadful PARM errors very often. I guess the new machine is too fast for the old Illy )
thanks in advance
Copy link to clipboard
Copied
can you share your script? can you share a test file?
It's very difficult to offer any advice or debugging at all unless we have something to work with.
Copy link to clipboard
Copied
additionally, i'm confused about what you mean when you say that your script "creates a new document and then crops it to the visible bounds". If you're creating a new document, presumably there is no artwork in it, so there can be no visible bounds, as visibleBounds is a property of an art object.
if you can provide as much information as possible, we will have a much better chance of being helpful.
Copy link to clipboard
Copied
We have a script that creates a document and then crops it to the visibleBounds rectangle.
Yea, when a new document is created, there's nothing in it and there's no visualBounds of anything.
Copy link to clipboard
Copied
Salut !
alert(app.documents[0].visibleBounds)
Retourne un tableau de 4 nombres
Lecture seule. Limites visibles du document, incluant l’épaisseur de contour de tous les objets de l’illustration.
- Si le document est vide
retourne
0,0,0,0
-------------------
en anglais
Read-only. The visible bounds of the document, including stroke width of any objects in the illustration.
Copy link to clipboard
Copied
Hi
I was not precise in the original post. After creating a new doc, I, of course, put some data into it...
An example file is attached - https://kerenmaizlish-my.sharepoint.com/:b:/g/personal/keren_kerenmaizlish_onmicrosoft_com/EchyQuITY...
printing alert(app.documents[0].visibleBounds)
in Illustrator 2014 and 2018 prints out different results ...
Any ideas ?
thanks
Keren
Copy link to clipboard
Copied
Salut !
Cela est peut-être dû à la position de l'origine des règles (globale),
en haut à gauche ou en bas à gauche
Sinon, applique le script suivant :
var thisDoc = app.documents[0];
var tb = thisDoc.visibleBounds;
w = tb[2]-tb[0];
h = tb[1]-tb[3];
x = tb[0];
y = tb[1];
cadre = thisDoc.pathItems.rectangle(y,x,w,h);
cadre.filled = false;
cadre.strokeDashes = [3.5,2];
alert(thisDoc.visibleBounds.join("\r"));
alert("rulerOrigin = \r"+thisDoc.rulerOrigin);
de LR
PS
Si vous ouvrez le fichier .pdf dans Illustrator,
Il faut, avant de lancer le script supprimer le masque d'écrêtage.
Copy link to clipboard
Copied
"visibleBounds" is not a valid property of the document object.
visibleBounds is a property of PageItem
Copy link to clipboard
Copied
Actually believe it or not, it is!
When the document is blank, it alerts this: 0,0,0,0.
But when you have a square with a 1 pt stroke with its geo bounds (the path corner) at 0,0 the visibleBounds are:
-0.5,0.5,150.5,-150.5
Copy link to clipboard
Copied
Thanks everyone for the help.
I found the real problem and hence the difference between the Illustrator 2014 and 2018
When looked closely at my file, I noticed an empty Path object at the outer perimeter
In Illustrator 2014 an empty path object does not count for "visible" and thus the visible boundary was smaller while in 2018 version it does count even though it is empty and has no stroke or anything at all
Find more inspiration, events, and resources on the new Adobe Community
Explore Now