Python-PyX绘图:PDF文件包含

2024-10-03 21:24:18 发布

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

我想在Python的PyX绘图中包含一个PDF文件。你知道吗

要包含SVG文件:

from pyx import *
c = canvas.canvas()
c.insert(svgfile.svgfile(0, 0, "file.svg"))
c.writeSVGfile("output")

要包含EPS文件:

from pyx import *
c = canvas.canvas()
c.insert(epsfile.epsfile(0, 0, "file.eps"))
c.writeEPSfile("output")

但是尝试PDF文件,它不起作用:

from pyx import *
c = canvas.canvas()
c.insert(pdffile.pdffile(0, 0, "file.pdf"))
c.writePDFfile("output")

如何插入PDF文件?你知道吗


Tags: 文件fromsvgimport绘图outputpdffile
1条回答
网友
1楼 · 发布于 2024-10-03 21:24:18

不幸的是,PyX中没有包含PDF格式的PDF。(不过,这是一个长期目标。)

你现在唯一能做的“解决方案”就是把你的PDF文件转换成位图(可能是png),然后用位图模块把它添加到你的输出中。你知道吗

相关问题 更多 >