使用 ghostscript 转换二进制流 api

Convert binary streamse use ghostscript api

如何将位于内存中的二进制 blob pdf 转换为与 jpeg 位于同一位置。使用纯 ghostscript api 界面。例如,gsdll32.dll.

建议的界面使用磁盘上的默认文件。

args = [
 "-dFirstPage=10",
 "-dLastPage=10",
 "-sDEVICE=jpeg",
"-r300",
"-sOutputFile=book.jpg",
"-dNOPAUSE",
"test2.pdf"
]

基本上,你不能。 Ghostscript PDF 解释器假定它处理磁盘上的文件(例如,参见 pdf_main.ps 中 runpdf 和 runpdfbegin 的定义)。也许您可以将其转换为流并传递,但对我来说,这看起来像很多工作,全部在 PostScript 中。

您绝对不能将 JPEG 输出写入同一内​​存位置。