InDesign CS4 - Javascript - 使文本区域透明

发布于 2024-08-18 13:03:21 字数 723 浏览 4 评论 0原文

在 InDesign CS4 设计器中,我可以非常轻松地将 TextArea 设为透明。我只需右键单击文档中的文本区域,选择效果-->透明度,然后在启动的“效果”窗口中,我可以将填充设置的“不透明度”设置为 0%。

我正在尝试找出一种通过 javascript 使 TextArea 透明的方法。我最初认为我可以通过类似于下面的代码的方式应用 ObjectStyle 来做到这一点:

//open document
var myDocument = app.open(new File(designFileName));
//grab the appropriate layer
var contentLayer = myDocument.layers.item("ContentLayer");
//create an objectstyle
var transparentObjStyle =  myDocument.objectStyles.add({name:"TransparentObjStyle", opacity:0});
//apply that object style to the document
contentLayer.textFrames[0].applyObjectStyle(transparentObjStyle, true);
//close the document

它很接近。它使 TextArea 透明,但在 TextArea 边框周围留下一个黑框。有没有人做过类似的事情并对如何进行有任何建议?

Within the InDesign CS4 designer, I can very easily make a TextArea transparent. I just right click on the TextArea within a document, select Effects-->Transparency, and within the “Effects” window that launches, I can set the “Opacity” to 0% on the Fill settings.

I am attempting to figure out a way to make a TextArea transparent via javascript. I initially thought that I could do this by applying an ObjectStyle via something similar to the code below:

//open document
var myDocument = app.open(new File(designFileName));
//grab the appropriate layer
var contentLayer = myDocument.layers.item("ContentLayer");
//create an objectstyle
var transparentObjStyle =  myDocument.objectStyles.add({name:"TransparentObjStyle", opacity:0});
//apply that object style to the document
contentLayer.textFrames[0].applyObjectStyle(transparentObjStyle, true);
//close the document

It is close. It makes the TextArea transparent, but it leaves a black box around the border of the TextArea. Has anyone done anything like this and have any suggestions on how to proceed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋意浓 2024-08-25 13:03:21

您可以尝试:visibility:hidden而不是opacity:0

You can try: visibility:hidden instead of opacity:0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文