![](/img/trans.png)
[英]Python InDesign scripting: Get overflowing textbox from preflight for automatic resizing
[英]Python InDesign scripting: How to run a preflight check?
这是对我有用的 Python 片段:
import win32com.client
app = win32com.client.Dispatch('InDesign.Application.CS6')
doc = app.Open(r'd:\temp\test.indd')
profile = app.PreflightProfiles.Item('Stackoverflow Profile')
print('Profile name:', profile.name)
process = app.PreflightProcesses.Add(doc, profile)
process.WaitForProcess()
results = (process.processResults)
print('Results:', results)
doc.Close()
input('\nDone... Press <ENTER> to close the window')
对于我的测试文件,当它出现“Overset Text”错误时,它会显示如下输出:
如果没有错误,我会得到这个:
当然,您需要使用您的实际文件名和配置文件更改代码中的文件名和配置文件名称。 也许您需要使用CC.2020
或您拥有的任何内容更改CS6
。
以防万一,代码的 ExtendScript 变体(对于已经打开的文档)如下所示:
var myDocument = app.activeDocument;
var myProfile = app.preflightProfiles.item('Stackoverflow Profile');
var myPreflight = app.preflightProcesses.add(myDocument, myProfile);
myPreflight.waitForProcess();
var results = (myPreflight.processResults);
alert(results);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.