问题标签 [indesign-server]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 如何通过 Soap 将 Java 类连接到 InDesign cs6 Server?(不要使用命令行参数。)
如何通过 Soap 将 Java 类(客户端)连接到 InDesign cs6 服务器?(不要使用命令行参数。)
adobe - app.doScript 和 $.evalFile 有什么区别?
到目前为止我发现的唯一区别:如果运行的脚本app.doScript
返回错误,则错误的文件和行号将被app.doScript
调用的文件和行号覆盖。
还有其他我应该知道的差异吗?
这是演示上述差异的示例代码:
首次运行 InDesign:
接下来创建一个批处理文件来运行脚本:
这是“call_doScript.jsx”,它将调用 app.doScript。
这是“called_by_doScript.jsx”,由前面的脚本调用:
运行批处理文件,结果如下:
请注意,上面的错误是不正确的。该错误是由 called_by_doScript 的第 3 行引起的,而不是 call_doScript 的第 2 行。
现在修改脚本以使用 $.evalFile,我们得到以下结果:
请注意,错误现在报告在正确的位置。
编辑:
我发现稀疏的文档。它并没有真正回答我的问题,但它确实描述了不同的可选参数。
doScript: Adobe InDesign CS6 脚本指南:JavaScript(直接链接)
参见第 16 页,“使用 doScript 方法”
evalFile: Javascript 工具指南:Adobe Creative Suite 5
参见第 219 页
scripting - InDesign Server CS5.5“ReferenceError: User cancelled this action/”关于 XML 导入
最近,当我们尝试将新的 InDesign 文档导入到文档中时,我收到了这个
ReferenceError: User cancelled this action。
有没有人知道这个错误实际上是什么?XML 是有效的,文档检查不确定它在抱怨什么。
adobe - Getting the stack trace of an error in ExtendScript
When I catch an error in ExtendScript, I would like to be able to log its stack trace. It appears that errors do not contain stack traces in ExtendScript, so I'm playing around with the idea of adding stack traces to errors.
The only way I know of to get a stack trace is $.stack
. The field $.stack
contains the current stack trace at the moment that you access the field.
My first attempt was to create my own error object that includes the stack. The Error
object is very special in that it can get the line and filename of the code that created it. For example,
Will print:
I don't think it's possible to create your own object with this ability. The closest I can get is this:
Which prints:
Here we can see that I'm creating my own error object and explicitly passing it the line and file name (since MyError can't figure that out on its own). I've also included the current stack when the error gets created.
This works fine when I call my own error object, but it doesn't work when other code calls the regular Error object or when an error is generated automatically (e.g. by illegal access). I want to be able to get the stack trace of any error, no matter how it is generated.
Other approaches might be to modify Error
's constructor, modify Error
's prototype, or replace the Error
object entirely. I haven't been able to get any of these approaches to work.
Another idea would be to put a catch block in every single method of my code and add the current stack to the error if it doesn't already have one. I would like to avoid this option if possible.
I'm out of ideas. Is there any way to get the stack trace of errors?
java - InDesign Server 5.5 一个文档中的多种页面尺寸
我能够使用 InDesign Server 5.5 生成 PDF 文件。现在我希望能够生成一个页面大小不同的 PDF 文件,即一页是 A4,而另一页是 A5。我似乎找不到要设置的正确属性,因为页面大小的设置是在文档级别而不是页面级别完成的,这就是为什么我只能设置整个文档的页面大小而不是每个文档的页面大小个别页面。有谁知道如何解决这个问题?
[编辑] 我尝试创建一个新的母版页并在我打算修改页面大小的页面上调用 setAppliedMasterPage。但是,我仍然找不到调用 MasterPage 对象以更改其尺寸的正确方法。
谢谢。
c++ - 从 ScriptManager(javascript) 获取返回的文本 - INDESIGN SDK 插件
我在我的 Indesign CS6 插件中使用 javascript。
它工作正常。
但是我现在需要我的 c++ 代码中的 javascript 代码的返回值。
我使用这个网站作为参考:
https://blogs.adobe.com/indesignsdk/running-a-script-from-an-indesign-plug-in/ _
我需要这样的东西:
scriptRunner->RunScript("function xpto(){return 'Hello World';};xpto()", params);
// 假方法
const char *string_return = scriptRunner->getReturnCode();
scriptManager 上有类似的东西吗?
ps:它不是indesign服务器。我放了这个标签是因为这个网站不允许我创建一个新标签......
此致,
adobe-indesign - 如何读取 indd 文件的表单字段
我制作了一个 .indd 文件,其中包含一些表单字段。
现在我想通过 indesign 脚本获取所有这些字段并操作其内容
这样我就可以更改字段的内容并将这些更改应用于 .indd 文件。
indesign-server - 使用 InDesign CS6 服务器脚本,我可以隐藏文档中的特定图层吗?
我们有一个系统允许用户在 InDesign IDML 文件中填写可变数据。输入信息后,InDesign 服务器会呈现 IDML 的 JPG 以供用户查看。输入所有数据后,用户可以请求 PDF(也由 InDesign 服务器呈现)。
我们希望通过允许用户在某些预先确定的内容布局的几个选项之间进行选择,从而允许用户进行进一步的定制。此内容将作为单独的层包含在 IDML 文件中。
我们目前的想法是,我们可以将可选内容添加到不同层的 IDML 文件中,并作为导出过程的一部分,根据用户的选择显示/隐藏层。
有没有办法使用 InDesign 服务器脚本界面动态显示或隐藏图层?关于可以做什么的文档非常稀少。
adobe-indesign - inDesign JSX 脚本将标题和内容添加到 textFrame
我正在尝试使用 inDesign JSX 脚本将以下数据插入到文档中:
数据必须放置在单个 TextFrame 中,但标题和内容的样式不同。
我可以看到添加文本的唯一方法是一次性通过textFrame.contents
变量:
然后,一旦数据进入,我会迭代段落并为标题添加一些样式:
这适用于适合一页的小型数据集,但一旦内容大于框架,则paragraphs
仅返回可见段落。如果我继续使用新的 textFrame,段落会被拆分,并且headingParagraphs[]
数组不再排列。
理想情况下,我想在附加下一个内容之前附加到内容并设置样式 - 但 API 文档不太清楚你如何做到这一点(如果有的话)
有没有办法使用附加功能或其他方式在添加内容后将标题分配到正确的位置来实现这一点?也许内容中的特殊字符来定义样式?
javascript - InDesign Server - 更新文本框架内容会导致内容丢失或多余
我正在尝试使用 InDesign Server 的 SOAP API 更新一系列文本框。当我尝试更改文本框的内容时,返回的结果有时会丢失或多余的内容。
这是我用来更新文本框的函数:
每次运行脚本时,它都会打开文档、进行更改、保存文档、生成 JPG 预览图像并关闭文档。为了将此问题与我调用它的 SOAP 接口和 PHP 脚本隔离开来,我没有将参数传递给脚本,只是在 JS 中使用字符串文字来传递新文本。
因此,如果我像这样更新一系列文本框:
在正常情况下,我得到的结果是这样的:
Textframe 550 总是省略我给出的最后一个字。
另一个问题是,如果我给任何文本框架一个中等长度的字符串,它就会被截断。如果我尝试将每个文本框的内容设置为“这是一些很长的文本,不同的文本框会在不同的点截断。”,结果如下:
奇怪的是,截止文本将被“记住”并在下次我将脚本作为垃圾运行时重新注入。因此,如果我然后重新运行脚本并尝试更改每个文本框架到非常短的东西,比如“垃圾邮件”,我得到以下结果:
如果我再次尝试运行它,我会得到:
依此类推,直到它用完旧文本。
即使我重新启动 IDS,这个问题仍然存在,所以(我猜)它必须以某种方式保存到文档中。
当我刚刚运行脚本来测试 IDS 重启时,当我刷新所有旧文本时,textframe 504 也开始跳过每个提交的最后一个单词......
知道是什么导致了这种行为,以及我如何才能让 IDS 将文本框更改为我给它的任何内容?