I second the SVG approach. If you want a PNG from that, there's resvg and librsvg.
SVG doesn't do layout, so you'll have to compute table widths manually. But if you're making an image, I presume you don't mind doing that, because you care how it looks. Otherwise you could generate CSV instead