InDesign javascript 查找重叠文本框 [英] InDesign javascript to find overlapping textframes

查看:21
本文介绍了InDesign javascript 查找重叠文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何在 InDesign 中使用 Javascript 搜索文档中重叠的任何文本框架?我一直在查看具有 TextFrame 的所有属性的文档,但找不到任何可以判断是否存在重叠框的内容.
我不懂 Javascript,但我懂 Ruby,所以我懂一点.

is there anyway in InDesign using Javascript to search for any text frames in a document that overlaps? I've been looking through a document with all the properties of TextFrame and can't find anything that might tell whether there's any overlapping boxes or not.
I don't know Javascript but do know Ruby so i understand bits of it.

推荐答案

每个 Page 对象都有一个只读属性 textFrames 和页面上的所有 textFrames.每个textFrame都有一个方法visibleBounds,它会以[x1,y1,x2,y2]的形式返回一个数组,这样你就可以得到这个文本的几何边界框架.

Each Page object has got a read only attribute textFrames with alle textFrames on the page. Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.

因此,您需要遍历页面的所有 textFrame,获取每个 textFrame 的边界,然后您必须检查它们中的任何一个是否相互重叠.

So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.

这篇关于InDesign javascript 查找重叠文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆