Adobe InDesign CS5 Server JavaScript:通过 XML 标记获取矩形
当前设置:
通过 PHP SOAP 通过 ExtendScript 编写 Adobe InDesign Server CS5 脚本
问题:
我当前正在将图像文件放入矩形中使用以下代码:
frame = doc.rectangles[0];
imgList = frame.place(new File(img));
这工作正常; img
文件按预期放置到矩形中。但是,这仅指文档中的第一个矩形:如果文档中有两个矩形,则图像将放置到最后创建的矩形中。
我理想地希望能够通过其 XML 标签来引用矩形 - 例如:
frame = doc.getRectangleByTag('Pic'); // <Pic> being the name of the XML tag
imgList = frame.place(new File(img));
有人对如何实现这一点有任何建议吗?我意识到这是一个基本的问题,但经过几个小时的搜索后我没有找到任何乐趣。
非常感谢
Current set-up:
Adobe InDesign Server CS5 scripted through ExtendScript via PHP SOAP
The problem:
I'm currently placing an image file into a rectangle using the following code:
frame = doc.rectangles[0];
imgList = frame.place(new File(img));
This works fine; the img
file is placed into the rectangle as expected. However, this only refers to the first rectangle in the document: if I have two rectangles in the document, the image is placed into the last created rectangle.
What I'd ideally like to be able to refer to the rectangle by its XML tag - something like:
frame = doc.getRectangleByTag('Pic'); // <Pic> being the name of the XML tag
imgList = frame.place(new File(img));
Does anyone have any advice as to how this can be achieved? I realise this is rudimentary question, but am finding no joy after several hours of searching.
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,没有“
getRectangleByTag
”方法。但是,如果您知道要查找的矩形的“id
”或“name
”属性,则可以循环遍历文档中的矩形并像这样查找它这:希望这有帮助!
There isn't a '
getRectangleByTag
' method that I know of. However, if you know the 'id
' or 'name
' property of the rectangle which you are looking for, you can loop through the rectangles in the document and finding it like this:Hope this helps!