简体   繁体   中英

How to insert a pydot chart into reportlab?

I created a graph in pydot, eg the python graphviz interface. Now, I would like to enter this graph into my reportlab report. Is there any direct way of doing this?

After an endless search, I figured there is no way. So, in the end I exported the pydot as a pdf, imported the pdf via PyPDF2 and then merged it with the ReportLab document. Far from ideal, but it does the job.

You can use a similar (but perhaps slightly better) path with pdfrw -- you can run pdfrw in conjunction with reportlab, and import the PDF you exported from pydot, and use it as a form XObject (similar to an image) on the reportlab canvas. There are a few examples showing how to do this sort of thing in the pdfrw examples/rl1 subdirectory. Disclaimer: I am the pdfrw author.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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