Skip to content

Cannot export objects with a specified id #332

@guillerodriguez

Description

@guillerodriguez

I have a svg document that contains an icon set. For each icon there is a rect with a specific id that defines the bounding box of the icon to be exported. With inkscape I can export individual icons as follows:

inkscape --export-filename icon101.png --export-id=icon101 all_icons.svg

Is this possible with CairoSVG? I have noticed that I can add a #fragment to the input file/url, and was hoping I could use this to specify the id of the object to export, but that fails:

$ cairosvg -f png -o icon101.png 'all_icons.svg#icon101'

Traceback (most recent call last):
[...]
TypeError: Root node is rect. Should be one of marker, svg, image, or g.

Is this use case supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions