gpt4 book ai didi

python - SimpleIDML 如何将 IDML 转换为 PDF?

转载 作者:行者123 更新时间:2023-11-28 18:30:55 25 4
gpt4 key购买 nike

我是 INDD CC 服务器的新手。我已经实现了 Indesign serverWindows 上运行。我需要将 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'

手动我可以在服务器目录中看到动态创建的目录tmp9LVUWj。服务器路径预计在同一时间。

无法弄清楚如何在代码中设置 indesign-server/workdir 和 access 以及如何解决?我在这上面花了很多时间,但找不到帮助或示例代码。

或者是否有其他 python 包可以将 IDML 转换为 PDF。

提前致谢

最佳答案

你写的,

Manually I can see dynamically created dir tmp9LVUWj inside server dir.

没错,但这不是错误。它声明在该目录中 找不到名为 save_as.jsx 的 JSX 文件。这实际上是您打算放置在那里的 JSX 文件的名称,还是现在驻留在那里的文件的名称?

关于python - SimpleIDML 如何将 IDML 转换为 PDF?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37479362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com