
On Mon, 29 Dec 2008 22:58:01 +0100 Bernd D. <Feldrain@...889...> wrote:
Hello,
I try to write a python script that help drawing diagrams (i.e. syntax diagrams). A node in this typ of diagram, is a rectangle with rounded edges and a centered text caption in it. In the script, I need the bounding box of the text, for the calculation of the correct node rectangle size, to hold the whole text in it. But how can I get the bounding box? Is there somebody that can point me to a solution?
I think you need to invoke inkscape a second time, using subprocess.Popen or similar, and grab the output from inkscape with the following flags:
inkscape --without-gui --query-all path/to/myfile.svg
you may need to right the DOM to a file first.
--query-all dumps id,x,y,width,height for every object in the file. If you only want info. on a single object you can use some of the other --query-??? flags - see inkscape --help
Cheers -Terry
Best regards, Bernd
Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel