Rsvg.Handle

g GObject.Object GObject.Object Rsvg.Handle Rsvg.Handle GObject.Object->Rsvg.Handle

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new ()
class new_from_data (data)
class new_from_file (filename)
class new_from_gfile_sync (file, flags, cancellable)
class new_from_stream_sync (input_stream, base_file, flags, cancellable)
class new_with_flags (flags)
  close ()
  get_base_uri ()
  get_dimensions ()
  get_dimensions_sub (id)
  get_geometry_for_element (id)
  get_geometry_for_layer (id, viewport)
  get_intrinsic_dimensions ()
  get_pixbuf ()
  get_pixbuf_sub (id)
  get_position_sub (id)
  has_sub (id)
  internal_set_testing (testing)
  read_stream_sync (stream, cancellable)
  render_cairo (cr)
  render_cairo_sub (cr, id)
  render_document (cr, viewport)
  render_element (cr, id, element_viewport)
  render_layer (cr, id, viewport)
  set_base_gfile (base_file)
  set_base_uri (base_uri)
  set_dpi (dpi)
  set_dpi_x_y (dpi_x, dpi_y)
  set_stylesheet (css)
  write (buf)

Virtual Methods

Inherited:GObject.Object (7)

Properties

Name Type Flags Short Description
base-uri str r/w/c Base URI for resolving relative references
desc str r deprecated deprecated
dpi-x float r/w/c Horizontal resolution in dots per inch
dpi-y float r/w/c Vertical resolution in dots per inch
em float r em deprecated
ex float r ex deprecated
flags Rsvg.HandleFlags r/w/co Loading flags
height int r Image height deprecated
metadata str r deprecated deprecated
title str r deprecated deprecated
width int r Image width deprecated

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class Rsvg.Handle(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Rsvg.HandleClass

Lets you load SVG data and render it.

classmethod new()
Returns:A new Rsvg.Handle with no flags set.
Return type:Rsvg.Handle

Returns a new rsvg handle. Must be freed with g_object_unref. This handle can be used to load an image.

The preferred way of loading SVG data into the returned Rsvg.Handle is with Rsvg.Handle.read_stream_sync().

The deprecated way of loading SVG data is with Rsvg.Handle.write() and Rsvg.Handle.close(); note that these require buffering the entire file internally, and for this reason it is better to use the stream functions: Rsvg.Handle.new_from_stream_sync(), Rsvg.Handle.read_stream_sync(), or Rsvg.Handle.new_from_gfile_sync().

After loading the Rsvg.Handle with data, you can render it using Cairo or get a GdkPixbuf.Pixbuf from it. When finished, free the handle with GObject.Object.unref(). No more than one image can be loaded with one handle.

Note that this function creates an Rsvg.Handle with no flags set. If you require any of Rsvg.HandleFlags to be set, use any of Rsvg.Handle.new_with_flags(), Rsvg.Handle.new_from_stream_sync(), or Rsvg.Handle.new_from_gfile_sync().

classmethod new_from_data(data)
Parameters:data (bytes) – The SVG data
Raises:GLib.Error
Returns:A Rsvg.Handle or None if an error occurs.
Return type:Rsvg.Handle

Loads the SVG specified by data. Note that this function creates an Rsvg.Handle without a base URL, and without any Rsvg.HandleFlags. If you need these, use Rsvg.Handle.new_from_stream_sync() instead by creating a Gio.MemoryInputStream from your data.

New in version 2.14.

classmethod new_from_file(filename)
Parameters:filename (str) – The file name to load, or a URI.
Raises:GLib.Error
Returns:A Rsvg.Handle or None if an error occurs.
Return type:Rsvg.Handle

Loads the SVG specified by file_name. Note that this function, like Rsvg.Handle.new(), does not specify any loading flags for the resulting handle. If you require the use of Rsvg.HandleFlags, use Rsvg.Handle.new_from_gfile_sync().

New in version 2.14.

classmethod new_from_gfile_sync(file, flags, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

a new Rsvg.Handle on success, or None with error filled in

Return type:

Rsvg.Handle

Creates a new Rsvg.Handle for file.

This function sets the “base file” of the handle to be file itself, so SVG elements like <image> which reference external resources will be resolved relative to the location of file.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned in error.

New in version 2.32.

classmethod new_from_stream_sync(input_stream, base_file, flags, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

a new Rsvg.Handle on success, or None with error filled in

Return type:

Rsvg.Handle

Creates a new Rsvg.Handle for stream.

This function sets the “base file” of the handle to be base_file if provided. SVG elements like <image> which reference external resources will be resolved relative to the location of base_file.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned in error.

New in version 2.32.

classmethod new_with_flags(flags)
Parameters:flags (Rsvg.HandleFlags) – flags from Rsvg.HandleFlags
Returns:a new Rsvg.Handle
Return type:Rsvg.Handle

Creates a new Rsvg.Handle with flags flags. After calling this function, you can feed the resulting handle with SVG data by using Rsvg.Handle.read_stream_sync().

New in version 2.36.

close()
Raises:GLib.Error
Returns:True on success, or False on error.
Return type:bool

Closes self, to indicate that loading the image is complete. This will return True if the loader closed successfully and the SVG data was parsed correctly. Note that self isn’t freed until g_object_unref is called.

Deprecated since version 2.46.: Use Rsvg.Handle.read_stream_sync() or the constructor functions Rsvg.Handle.new_from_gfile_sync() or Rsvg.Handle.new_from_stream_sync(). See the deprecation notes for Rsvg.Handle.write() for more information.

get_base_uri()
Returns:the base uri, possibly null
Return type:str

Gets the base uri for this Rsvg.Handle.

New in version 2.8.

get_dimensions()
Returns:A place to store the SVG’s size
Return type:dimension_data: Rsvg.DimensionData

Get the SVG’s size. Do not call from within the size_func callback, because an infinite loop will occur.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

New in version 2.14.

get_dimensions_sub(id)
Parameters:id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to use the whole SVG.
Returns:
dimension_data:A place to store the SVG’s size
Return type:(bool, dimension_data: Rsvg.DimensionData)

Get the size of a subelement of the SVG file. Do not call from within the size_func callback, because an infinite loop will occur.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

New in version 2.22.

Deprecated since version 2.46.: Use Rsvg.Handle.get_geometry_for_layer() instead.

get_geometry_for_element(id)
Parameters:id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to compute the geometry for the whole SVG.
Raises:GLib.Error
Returns:
out_ink_rect:Place to store the ink rectangle of the element.
out_logical_rect:
 Place to store the logical rectangle of the element.
Return type:(bool, out_ink_rect: Rsvg.Rectangle, out_logical_rect: Rsvg.Rectangle)

Computes the ink rectangle and logical rectangle of a singe SVG element.

While rsvg_handle_get_geometry_for_layer computes the geometry of an SVG element subtree with its transformation matrix, this other function will compute the element’s geometry as if it were being rendered under an identity transformation by itself. That is, the resulting geometry is as if the element got extracted by itself from the SVG.

This function is the counterpart to rsvg_handle_render_element.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

The “ink rectangle” is the bounding box that would be painted for fully- stroked and filled elements.

The “logical rectangle” just takes into account the unstroked paths and text outlines.

Note that these bounds are not minimum bounds; for example, clipping paths are not taken into account.

You can pass None for the id if you want to measure all the elements in the SVG, i.e. to measure everything from the root element.

This operation is not constant-time, as it involves going through all the child elements.

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

get_geometry_for_layer(id, viewport)
Parameters:
  • id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to compute the geometry for the whole SVG.
  • viewport (Rsvg.Rectangle) – Viewport size at which the whole SVG would be fitted.
Raises:

GLib.Error

Returns:

out_ink_rect:Place to store the ink rectangle of the element.
out_logical_rect:
 Place to store the logical rectangle of the element.

Return type:

(bool, out_ink_rect: Rsvg.Rectangle, out_logical_rect: Rsvg.Rectangle)

Computes the ink rectangle and logical rectangle of an SVG element, or the whole SVG, as if the whole SVG were rendered to a specific viewport.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

The “ink rectangle” is the bounding box that would be painted for fully- stroked and filled elements.

The “logical rectangle” just takes into account the unstroked paths and text outlines.

Note that these bounds are not minimum bounds; for example, clipping paths are not taken into account.

You can pass None for the id if you want to measure all the elements in the SVG, i.e. to measure everything from the root element.

This operation is not constant-time, as it involves going through all the child elements.

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

get_intrinsic_dimensions()
Returns:
out_has_width:Will be set to True if the toplevel SVG has a width attribute
out_width:Will be set to the value of the width attribute in the toplevel SVG
out_has_height:Will be set to True if the toplevel SVG has a height attribute
out_height:Will be set to the value of the height attribute in the toplevel SVG
out_has_viewbox:
 Will be set to True if the toplevel SVG has a viewBox attribute
out_viewbox:Will be set to the value of the viewBox attribute in the toplevel SVG
Return type:(out_has_width: bool, out_width: Rsvg.Length, out_has_height: bool, out_height: Rsvg.Length, out_has_viewbox: bool, out_viewbox: Rsvg.Rectangle)

Queries the width, height, and viewBox attributes in an SVG document.

If you are calling this function to compute a scaling factor to render the SVG, consider simply using Rsvg.Handle.render_document() instead; it will do the scaling computations automatically.

As an example, the following SVG element has a width of 100 pixels and a height of 400 pixels, but no viewBox :

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="400">

Conversely, the following element has a viewBox, but no width or height :

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 400">

Note that the Rsvg.Length return values have Rsvg.Units in them; you should not assume that they are always in pixels. For example, the following SVG element will return a width value whose units field is Rsvg.Unit.MM.

<svg xmlns="http://www.w3.org/2000/svg" width="210mm" height="297mm">

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

get_pixbuf()
Returns:the pixbuf loaded by self, or None.
Return type:GdkPixbuf.Pixbuf or None

Returns the pixbuf loaded by self. The pixbuf returned will be reffed, so the caller of this function must assume that ref. If insufficient data has been read to create the pixbuf, or an error occurred in loading, then None will be returned. Note that the pixbuf may not be complete until rsvg_handle_close has been called.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

get_pixbuf_sub(id)
Parameters:id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to use the whole SVG.
Returns:a pixbuf, or None if an error occurs during rendering.
Return type:GdkPixbuf.Pixbuf or None

Creates a GdkPixbuf.Pixbuf the same size as the entire SVG loaded into self, but only renders the sub-element that has the specified id (and all its sub-sub-elements recursively). If id is None, this function renders the whole SVG.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

If you need to render an image which is only big enough to fit a particular sub-element of the SVG, consider using Rsvg.Handle.render_cairo_sub(), upon a surface that is just the size returned by Rsvg.Handle.get_dimensions_sub(). You will need to offset the rendering by the amount returned in Rsvg.Handle.get_position_sub().

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

New in version 2.14.

get_position_sub(id)
Parameters:id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to use the whole SVG.
Returns:
position_data:A place to store the SVG fragment’s position.
Return type:(bool, position_data: Rsvg.PositionData)

Get the position of a subelement of the SVG file. Do not call from within the size_func callback, because an infinite loop will occur.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

New in version 2.22.

Deprecated since version 2.46.: Use Rsvg.Handle.get_geometry_for_layer() instead.

has_sub(id)
Parameters:id (str) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID.
Returns:True if id exists in the SVG document, False otherwise.
Return type:bool

Checks whether the element id exists in the SVG document.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

New in version 2.22.

internal_set_testing(testing)
Parameters:testing (bool) – Whether to enable testing mode

Do not call this function. This is intended for librsvg’s internal test suite only.

read_stream_sync(stream, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if reading stream succeeded, or False otherwise with error filled in

Return type:

bool

Reads stream and writes the data from it to self.

Before calling this function, you may need to call Rsvg.Handle.set_base_uri() or Rsvg.Handle.set_base_gfile() to set the “base file” for resolving references to external resources. SVG elements like <image> which reference external resources will be resolved relative to the location you specify with those functions.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

New in version 2.32.

render_cairo(cr)
Parameters:cr (cairo.Context) – A Cairo context
Returns:True if drawing succeeded; False otherwise.
Return type:bool

Draws a loaded SVG handle to a Cairo context. Drawing will occur with respect to the cr’s current transformation: for example, if the cr has a rotated current transformation matrix, the whole SVG will be rotated in the rendered version.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

Note that cr must be a Cairo context that is not in an error state, that is, cairo_status() must return cairo.Status.SUCCESS for it. Cairo can set a context to be in an error state in various situations, for example, if it was passed an invalid matrix or if it was created for an invalid surface.

New in version 2.14.

render_cairo_sub(cr, id)
Parameters:
  • cr (cairo.Context) – A Cairo context
  • id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to render the whole SVG.
Returns:

True if drawing succeeded; False otherwise.

Return type:

bool

Draws a subset of a loaded SVG handle to a Cairo context. Drawing will occur with respect to the cr’s current transformation: for example, if the cr has a rotated current transformation matrix, the whole SVG will be rotated in the rendered version.

This function depends on the Rsvg.Handle’s DPI to compute dimensions in pixels, so you should call Rsvg.Handle.set_dpi() beforehand.

Note that cr must be a Cairo context that is not in an error state, that is, cairo_status() must return cairo.Status.SUCCESS for it. Cairo can set a context to be in an error state in various situations, for example, if it was passed an invalid matrix or if it was created for an invalid surface.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

New in version 2.14.

render_document(cr, viewport)
Parameters:
Raises:

GLib.Error

Return type:

bool

Renders the whole SVG document fitted to a viewport.

The viewport gives the position and size at which the whole SVG document will be rendered.

The cr must be in a cairo.Status.SUCCESS state, or this function will not render anything, and instead will return an error.

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

render_element(cr, id, element_viewport)
Parameters:
  • cr (cairo.Context) – A Cairo context
  • id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to render the whole SVG document tree.
  • element_viewport (Rsvg.Rectangle) – Viewport size in which to fit the element
Raises:

GLib.Error

Return type:

bool

Renders a single SVG element to a given viewport

This function can be used to extract individual element subtrees and render them, scaled to a given element_viewport. This is useful for applications which have reusable objects in an SVG and want to render them individually; for example, an SVG full of icons that are meant to be be rendered independently of each other.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

You can pass None for the id if you want to render all the elements in the SVG, i.e. to render everything from the root element.

The element_viewport gives the position and size at which the named element will be rendered. FIXME: mention proportional scaling.

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

render_layer(cr, id, viewport)
Parameters:
  • cr (cairo.Context) – A Cairo context
  • id (str or None) – An element’s id within the SVG, starting with “##” (a single hash character), for example, “##layer1”. This notation corresponds to a URL’s fragment ID. Alternatively, pass None to render the whole SVG document tree.
  • viewport (Rsvg.Rectangle) – Viewport size at which the whole SVG would be fitted.
Raises:

GLib.Error

Return type:

bool

Renders a single SVG element in the same place as for a whole SVG document.

This is equivalent to Rsvg.Handle.render_document(), but it renders only a single element and its children, as if they composed an individual layer in the SVG. The element is rendered with the same transformation matrix as it has within the whole SVG document. Applications can use this to re-render a single element and repaint it on top of a previously-rendered document, for example.

Element IDs should look like an URL fragment identifier; for example, pass “##foo” (hash foo) to get the geometry of the element that has an id="foo" attribute.

You can pass None for the id if you want to render all the elements in the SVG, i.e. to render everything from the root element.

API ordering: This function must be called on a fully-loaded self. See the section API ordering for details.

Panics: this function will panic if the self is not fully-loaded.

New in version 2.46.

set_base_gfile(base_file)
Parameters:base_file (Gio.File) – a Gio.File

Set the base URI for self from file.

Note: This function may only be called before Rsvg.Handle.write() or Rsvg.Handle.read_stream_sync() have been called.

New in version 2.32.

set_base_uri(base_uri)
Parameters:base_uri (str) – The base uri

Set the base URI for this SVG.

Note: This function may only be called before Rsvg.Handle.write() or Rsvg.Handle.read_stream_sync() have been called.

New in version 2.9.

set_dpi(dpi)
Parameters:dpi (float) – Dots Per Inch (i.e. as Pixels Per Inch)

Sets the DPI at which the self will be rendered. Common values are 75, 90, and 300 DPI.

Passing a number <= 0 to dpi will reset the DPI to whatever the default value happens to be, but since Rsvg.set_default_dpi() is deprecated, please do not pass values <= 0 to this function.

New in version 2.8.

set_dpi_x_y(dpi_x, dpi_y)
Parameters:
  • dpi_x (float) – Dots Per Inch (i.e. Pixels Per Inch)
  • dpi_y (float) – Dots Per Inch (i.e. Pixels Per Inch)

Sets the DPI at which the self will be rendered. Common values are 75, 90, and 300 DPI.

Passing a number <= 0 to dpi will reset the DPI to whatever the default value happens to be, but since Rsvg.set_default_dpi_x_y() is deprecated, please do not pass values <= 0 to this function.

New in version 2.8.

set_stylesheet(css)
Parameters:css (bytes) – String with CSS data; must be valid UTF-8.
Raises:GLib.Error
Return type:bool

Sets a CSS stylesheet to use for an SVG document.

The css_len argument is mandatory; this function will not compute the length of the css string. This is because a provided stylesheet, which the calling program could read from a file, can have nul characters in it.

During the CSS cascade, the specified stylesheet will be used with a “User” origin.

Note that @import rules will not be resolved, except for data: URLs.

New in version 2.48.

write(buf)
Parameters:buf (bytes) – pointer to svg data
Raises:GLib.Error
Returns:True on success, or False on error.
Return type:bool

Loads the next count bytes of the image.

Before calling this function for the first time, you may need to call Rsvg.Handle.set_base_uri() or Rsvg.Handle.set_base_gfile() to set the “base file” for resolving references to external resources. SVG elements like <image> which reference external resources will be resolved relative to the location you specify with those functions.

Deprecated since version 2.46.: Use Rsvg.Handle.read_stream_sync() or the constructor functions Rsvg.Handle.new_from_gfile_sync() or Rsvg.Handle.new_from_stream_sync(). This function is deprecated because it will accumlate data from the buf in memory until Rsvg.Handle.close() gets called. To avoid a big temporary buffer, use the suggested funtions, which take a Gio.File or a Gio.InputStream and do not require a temporary buffer.

Property Details

Rsvg.Handle.props.base_uri
Name:base-uri
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

Base URI for resolving relative references

Rsvg.Handle.props.desc
Name:desc
Type:str
Default Value:None
Flags:READABLE

SVG’s description.

Deprecated since version 2.36.: Reading this property always returns None.

Rsvg.Handle.props.dpi_x
Name:dpi-x
Type:float
Default Value:0.0
Flags:READABLE, WRITABLE, CONSTRUCT

Horizontal resolution in dots per inch

Rsvg.Handle.props.dpi_y
Name:dpi-y
Type:float
Default Value:0.0
Flags:READABLE, WRITABLE, CONSTRUCT

Vertical resolution in dots per inch

Rsvg.Handle.props.em
Name:em
Type:float
Default Value:0.0
Flags:READABLE

Exact width, in pixels, of the rendered SVG before calling the size callback as specified by rsvg_handle_set_size_callback().

Deprecated since version 2.46.: Reading each of the size properties causes the size of the SVG to be recomputed, so reading both the em and ex properties will cause two such computations. Please use Rsvg.Handle.get_intrinsic_dimensions() instead.

Rsvg.Handle.props.ex
Name:ex
Type:float
Default Value:0.0
Flags:READABLE

Exact height, in pixels, of the rendered SVG before calling the size callback as specified by rsvg_handle_set_size_callback().

Deprecated since version 2.46.: Reading each of the size properties causes the size of the SVG to be recomputed, so reading both the em and ex properties will cause two such computations. Please use Rsvg.Handle.get_intrinsic_dimensions() instead.

Rsvg.Handle.props.flags
Name:flags
Type:Rsvg.HandleFlags
Default Value:Rsvg.HandleFlags.FLAGS_NONE
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Flags from Rsvg.HandleFlags.

New in version 2.36.

Rsvg.Handle.props.height
Name:height
Type:int
Default Value:0
Flags:READABLE

Height, in pixels, of the rendered SVG after calling the size callback as specified by rsvg_handle_set_size_callback().

Deprecated since version 2.46.: For historical reasons, this property is of integer type, which cannot give the exact size of SVG images that are not pixel-aligned. Moreover, reading each of the size properties causes the size of the SVG to be recomputed, so reading both the width and height properties will cause two such computations. Please use Rsvg.Handle.get_intrinsic_dimensions() instead.

Rsvg.Handle.props.metadata
Name:metadata
Type:str
Default Value:None
Flags:READABLE

SVG’s metadata

Deprecated since version 2.36.: Reading this property always returns None.

Rsvg.Handle.props.title
Name:title
Type:str
Default Value:None
Flags:READABLE

SVG’s title.

Deprecated since version 2.36.: Reading this property always returns None.

Rsvg.Handle.props.width
Name:width
Type:int
Default Value:0
Flags:READABLE

Width, in pixels, of the rendered SVG after calling the size callback as specified by rsvg_handle_set_size_callback().

Deprecated since version 2.46.: For historical reasons, this property is of integer type, which cannot give the exact size of SVG images that are not pixel-aligned. Moreover, reading each of the size properties causes the size of the SVG to be recomputed, so reading both the width and height properties will cause two such computations. Please use Rsvg.Handle.get_intrinsic_dimensions() instead.