我是INDD CC Server的新手。我已在 Windows 上运行已实施Indesign server。我需要将 IDML转换为PDF 但有问题。
我使用过SimpleIDML Python library to manipulate Adobe(r) IDML(r) files.
我的示例脚本是
I2P.py
from simple_idml.indesign import indesign
idml_file = "/home/user/Project/EPS/media/test/2-idml/test001.idml"
indd_file = "/home/user/Project/EPS/media/test/InDesigndocument/test001.indd"
url_path = "http://192.168.1.1:12345/"
client_dir = "/home/user/Project/EPS/media/source"
server_dir = "/home/user/Project/EPS/media/server"
response = indesign.save_as(indd_file, [{
"fmt": "pdf",
"params": {"colorSpace": "CMYK"},
}],
url_path,
client_dir,
server_dir)[0]
with open("my_file.pdf", "w+") as f:
f.write(response)
在文档中:
response = indesign.save_as("/path_to_file.indd", [{ "fmt": "pdf", "params": {"colorSpace": "CMYK"}, }], "http://url-to-indesign-server:port", "/path/to/client/workdir", "/path/to/indesign-server/workdir")[0]
当我运行I2P脚本时,我将错误视为:
Traceback (most recent call last):
File "ItoP.py", line 12, in <module>
server_path)[0]
File "/home/user/eps2_env/local/lib/python2.7/site-packages/simple_idml/indesign/indesign.py", line 71, in new_func
logger, logger_extra)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/simple_idml/indesign/indesign.py", line 180, in save_as
responses = map(lambda fmt: _save_as(fmt), dst_formats_params)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/simple_idml/indesign/indesign.py", line 180, in <lambda>
responses = map(lambda fmt: _save_as(fmt), dst_formats_params)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/simple_idml/indesign/indesign.py", line 149, in _save_as
response = cl.service.RunScript(params)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/suds/client.py", line 649, in send
result = self.failed(binding, e)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/suds/client.py", line 702, in failed
r, p = binding.get_fault(reply)
File "/home/user/eps2_env/local/lib/python2.7/site-packages/suds/bindings/binding.py", line 265, in get_fault
raise WebFault(p, faultroot)
suds.WebFault: Server raised fault: 'The specified script file can not be found: /home/user/Project/EPS/media/server/tmp9LVUWj/save_as.jsx'
手动我可以在服务器目录中看到动态创建的dir tmp9LVUWj 。服务器路径同时期待。
无法弄清楚如何在代码中设置indesign-server / workdir和access以及如何解决?我花了很多时间在这上面,却无法找到帮助或示例代码。
或者是否有其他python包可以从IDML转换为PDF。
提前致谢
答案 0 :(得分:1)
你写道,
手动我可以在服务器内看到动态创建的dir tmp9LVUWj DIR。
这是事实,但这不是错误。它声明它无法在目录中找到名为save_as.jsx 的JSX文件。这实际上是您打算放在那里的JSX文件的名称,还是现在驻留在那里的文件?