如何将XML转换为SimpleIDML?

2024-06-23 19:54:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新来的INDD CC服务器。我已经实现了Indesign server运行在Windows上。我需要将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脚本时,会抛出错误:

^{pr2}$

手动地我可以看到动态创建的dirtmp9LVUWj在服务器目录内。服务器路径应在同一时间。在

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

或者有没有其他python包可以从IDML转换成PDF。在

提前谢谢


Tags: topath服务器projecthomeserverdireps
1条回答
网友
1楼 · 发布于 2024-06-23 19:54:06

你写的

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

这是真的,但那不是错误。它声明找不到名为save的JSX文件_as.jsx公司目录中。这实际上是您打算放在那里的JSX文件名,还是现在驻留在那里的文件名?在

相关问题 更多 >

    热门问题