InDesign CS4 - Javascript - 使文本区域透明
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试:visibility:hidden而不是opacity:0
You can try: visibility:hidden instead of opacity:0