繁体   English   中英

编辑:Ghostscript 可以给我二进制数据而不是输出到目录吗?

[英]EDIT: Can Ghostscript give me the binary data rather than output to a directory?

我目前有一个 Python 脚本,它运行 Ghostscript 命令将 PDF 的第一页转换为 PNG。 但是,现在图像只是进入我的目录之一。 是否可以让 Ghostscript 输出二进制数据,以便我可以将其保存到数据库中?

args = [
    "pdf2img", # actual value doesn't matter
    "-sOutputFile=testing.png",
    "-dNOPAUSE",
    "-dBATCH",
    "-sDEVICE=png256",
    "-sPAPERSIZE=a1",
    "-dPDFFitPage=true",
    "-dFirstPage=1",
    "-dLastPage=1",
    "testPDF.pdf"
    ]

ghostscript.Ghostscript(*args)

您可以通过说 -sOutputFile=%stdout 让 Ghostscript 将输出通过管道传输到 stdout。 除此之外,我想不出你所说的“给你二进制数据”是什么意思。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM