Search code examples
pythonpdfplotpyx

Python PyX plot: PDF file inclusion


I want to include a PDF file in a PyX plot in Python.

To include SVG file:

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

To include EPS file:

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

But try PDF file and it doesn't work:

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

How can I insert a PDF file?


Solution

  • Unfortunately, including PDF in PDF is not available in PyX. (It is a long-term goal, though.)

    The only "solution" you can do right now is to convert your PDF to be included into a bitmap (probably a png) and use the bitmap module to add this to your output.