通过命令行将PDF批量转换为EPS

发布于 2025-01-18 21:42:02 字数 1114 浏览 5 评论 0原文

我正在尝试通过inkscape和python将一些数字从 *.pdf转换为 *.eps。我求助于 inkscape手册 inkscape wiki 并提出以下代码。但是,当我运行脚本时,没有将输出写入工作目录中。

import os 
import subprocess

# Change to working directory
os.chdir("C:/Users/Username/Figures")

# Iterate over all PDF figures
for figure in [i for i in os.listdir() if i[-4:]=='.pdf']:

    subprocess.run([
        "C:/Program Files/Inkscape/inkscape.exe",
        figure, # Input figure
        f"--export-filename={figure[:-4]}.eps", # Output figure
        "--batch-process"
        ])

还有一个 stackoverflow上的类似问题。但是,如果我将 *.emf替换为 *.eps 答案 latex无法读取文件。


更新:Inkscape版本0.92.4(5DA689C313,2019-01-14)

I am trying to convert some figures from *.pdf to *.eps via Inkscape and Python. I resorted to the Inkscape Manual and Inkscape Wiki and came up with the code below. However when I run the script, no output is written into the working directory.

import os 
import subprocess

# Change to working directory
os.chdir("C:/Users/Username/Figures")

# Iterate over all PDF figures
for figure in [i for i in os.listdir() if i[-4:]=='.pdf']:

    subprocess.run([
        "C:/Program Files/Inkscape/inkscape.exe",
        figure, # Input figure
        f"--export-filename={figure[:-4]}.eps", # Output figure
        "--batch-process"
        ])

There is also a similar question on Stackoverflow. However, if I replace *.emf with *.eps in the answer the files cannot be read by LaTeX.


Update: Inkscape version 0.92.4 (5da689c313, 2019-01-14)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文