Copy link to clipboard
Copied
It seems that exceeding the geometricBounds has no effect.
I tested this:
var sel = app.documents[0].selection;
var pb = sel[j].parentPage.bounds;
sel[j].geometricBounds = [-10, -10, pb[2], pb[3]]
and found it to be very wrong.
In addition to Rob's note, it could be that your document offset is not exactly 0 or your units are off. You can do something like this instead (from chat gpt... seems good)
// Resize selected rectangle to page size including bleed
if (app.documents.length > 0 && app.selection.length === 1 && app.selection[0] instanceof Rectangle) {
var doc = app.activeDocument;
var page = app.selection[0].parentPage;
if (page == null) {
alert("The selected rectangle is not on a page.");
} else {
// Get bleed values
Copy link to clipboard
Copied
the geometricBounds has no effect.
What is [j] ?
Copy link to clipboard
Copied
In addition to Rob's note, it could be that your document offset is not exactly 0 or your units are off. You can do something like this instead (from chat gpt... seems good)
// Resize selected rectangle to page size including bleed
if (app.documents.length > 0 && app.selection.length === 1 && app.selection[0] instanceof Rectangle) {
var doc = app.activeDocument;
var page = app.selection[0].parentPage;
if (page == null) {
alert("The selected rectangle is not on a page.");
} else {
// Get bleed values from document
var bleed = doc.documentPreferences;
var bleedTop = bleed.documentBleedTopOffset;
var bleedBottom = bleed.documentBleedBottomOffset;
var bleedInside = bleed.documentBleedInsideOrLeftOffset;
var bleedOutside = bleed.documentBleedOutsideOrRightOffset;
// Get page bounds [y1, x1, y2, x2] in points
var pageBounds = page.bounds;
// Calculate new bounds including bleed
var newY1 = pageBounds[0] - bleedTop;
var newX1 = pageBounds[1] - bleedInside;
var newY2 = pageBounds[2] + bleedBottom;
var newX2 = pageBounds[3] + bleedOutside;
// Resize the selected rectangle
var rect = app.selection[0];
rect.geometricBounds = [newY1, newX1, newY2, newX2];
}
} else {
alert("Please select a single rectangle on a page.");
}
Copy link to clipboard
Copied
Hi brian_p_dts.
There is a lot of useful information here. I will study it.
Thank you very much.
Copy link to clipboard
Copied
Not correct on the right page
Find more inspiration, events, and resources on the new Adobe Community
Explore Now