Copy link to clipboard
Copied
Hi Team,
I have started working on InDesign Server (IDS). Following code is working on Desktop version, But the same code is not running in the IDS server. Please check and do the needful.
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;
Thanks
Venkadesh.
Hi Venkadesh,
As i mentioned there is not such global setting on IDS that you can use as you have been doing on desktop version. The solution to your problem is that you will have to identify/rewrite the satements in your code that need setting of anchorpoint and set ancohor point using the relevant methods like resize etc.
-Manan
Copy link to clipboard
Copied
No wonder. InDesign Server has no user interface. There is no layout window. There is no window at all, I think.
Things with "active" will not work:
activeDocument
activeSpread
activePage
activeLayer*
Regards,
Uwe Laubender
( ACP )
* EDIT: I was corrected. activeLayer is available in InDesign Server
Thanks, Venkadesh!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @Sumit,
If it works then make merry and use it. What Uwe wanted to convey is that methods/properties starting with "active" have a high chance of not being available in IDS. However, it is for the InDesign development team to be consistent in the naming of the methods/properties.
-Manan
Copy link to clipboard
Copied
Hi @Manan Joshi ,
You are absolutely right, I am just telling you that activeLayer property of Document works on IDS too. I am not telling about activeWindow.
Copy link to clipboard
Copied
Hi Venkadesh,
As you must know that IDS does not have a UI component so any method/property that refers to an UI element is not available in IDS. Now i see that you are trying to set the anchor point for the operations that follow this statement. If you look at the method description of methods like resize, resolve etc you will see that these methods do take as an argument the transform origin, so rather than setting it via the code you have you can pass the anchor point as an argument to the method yo want to call
See example below for the resize method argument list
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PageItem.html#d1e208048__d1e211271
-Manan
Copy link to clipboard
Copied
Hi Uwe/Manan,
Thanks for your immediate response. As you told, I have some basics about IDS that do not support Selection, Interaction, Groups.Add(), Cut, Copy, Paste, Undo, ActiveDocument, ActiveWindow e.t.c., Now i need to set the anchor point as left for all the activeWindow. Kindly provide the samples for TransformReferencePoint in IDS.
Thanks,
Venkadesh
Copy link to clipboard
Copied
Hi Venkadesh,
As i mentioned you will have to set this for each operation like transformation, resizing etc that you will do. Every operation that does make use of anchor point is done using a method and that method takes an argument of anchor point so you should be fine
An example could be something like the following
obj.resize(CoordinateSpaces.innerCoordinates, AnchorPoint.TOP_LEFT_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [x, y])
-Manan
Copy link to clipboard
Copied
Hi Manan,
I understand. But, I do not want to resize the pageItems, because of the original pagination being affected. Is there any other way to set the anchor point without affecting output. Also kindly help on the following doubts.
1) Obj denotes to TextFrame (or) Document (or) Application
2) Where I get the original X and Y values.
While I testing with the following code, all the inner objects are shrinked. Kindly check and do the needful.
var myCounter = 0;
var myCeiling = myDoc.pageItems.length;
for (var myCounter = 0; myCounter <= myCeiling; myCounter ++)
{
var pageItem = myDoc.pageItems[myCounter];
//myDoc.pageItem(myCounter).select;
pageItem.resize(CoordinateSpaces.PASTEBOARD_COORDINATES,AnchorPoint.TOP_LEFT_ANCHOR,ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[0,0],1,1);
}
Thanks,
Venkadesh.
Copy link to clipboard
Copied
As i mentioned you can't set the anchor point on IDS since you don't have anything like activeWindow on IDS. Now let me put another question to you, why do you want to set the anchor point? Anchor point effects transformation operations as far as i know, if you don't want to do any transformation then why do you want to set anchor.
Now with regards your question
1. Obj was just denoting a sample object that supports resize to provide you a sample code. It can be a textframe, rectangle, page etc. Look the object model for the object you are interested in working. I provided link for pagetitem's method description in earlier post
2. What do you mean by original X,Y? The x,y in the sample code were the new dimesions of the pageitem. Since you are setting it to 0,0 that is why you see an shrinkage of the object. If you want to get the coordinates of say top left of a pageitem then you can check the resolve method
-Manan
Copy link to clipboard
Copied
Hi Manan,
Thanks for your answers. Please find the original code from the follows,
1) Retrieving "ChapterNumber" frame,
2) Setting some "minimumFirstBaselineOffset" value for collected TextFrame.
3) Before we assigning values, we just setting anchor point, Now its show error on IDS migration.
app.documents[0].textPreferences.highlightSubstitutedFonts = true;
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;
app.documents.item(0).viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
app.documents.item(0).viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
app.documents.item(0).viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
var st = app.documents[0].xmlElements.item(0).evaluateXPathExpression("//ChapterNumber");
if (app.documents[0].xmlElements.item(0).evaluateXPathExpression("//ChapterNumber").length == 1) {
app.documents[0].xmlElements.item(0).evaluateXPathExpression("//ChapterNumber")[0].insertionPoints[0].parentTextFrames[0].textFramePreferences.minimumFirstBaselineOffset = "65.2pt";
}
Thanks,
Venkadesh.
Copy link to clipboard
Copied
Hi Venkadesh,
Looking at this piece of your code i am not sure if setting up the anchor serves any purpose, as the only thing that might be affected by it is the baselineoffset setting. Comment out the line where you set the anchor point and run your code to see does it produce results different from the desktop version of output where you do set the anchor point.
P.S. :- If this snippet is part of a bigger codebase then we could have code(not shared here) that are effected by anchor point.
-Manan
Copy link to clipboard
Copied
Hi Manan,
I should change the subject line as "transformReferencePoint for InDesign Server". Because, I just shared a piece of code from the complex workflow. I should setting up the Anchor Point (Top_Left) at start of the workflow, then only we start increasing height and width of the textframe(Box) as spec desired values. Please check and confirm any feasibilities or close this thread with conclusion.
Thanks
Venkadesh.
Copy link to clipboard
Copied
Hi Venkadesh,
As i mentioned there is not such global setting on IDS that you can use as you have been doing on desktop version. The solution to your problem is that you will have to identify/rewrite the satements in your code that need setting of anchorpoint and set ancohor point using the relevant methods like resize etc.
-Manan
Copy link to clipboard
Copied
Hi Venkadesh,
sorry, I did not want to confuse you.
my statement was just out of memory.
In the meanwhile I can see that also activeProcess is also available.
( No wonder, this is a preflight process. )
Regards,
Uwe Laubender
( ACP )
Find more inspiration, events, and resources on the new Adobe Community
Explore Now