### Method

# Rsvg Handle set_size_callback

deprecated: 2.14.

#### Declaration [src]

    void
    rsvg_handle_set_size_callback (
      RsvgHandle* handle,
      RsvgSizeFunc size_func,
      gpointer user_data,
      GDestroyNotify user_data_destroy
    )

#### Description [src]

Sets the sizing function for the `handle`, which can be used to override the size that librsvg computes for SVG images. The `size_func` is called from the following functions:

- `rsvg_handle_get_dimensions()`
- `rsvg_handle_get_dimensions_sub()`
- `rsvg_handle_get_position_sub()`
- `rsvg_handle_render_cairo()`
- `rsvg_handle_render_cairo_sub()`

Librsvg computes the size of the SVG being rendered, and passes it to the `size_func`, which may then modify these values to set the final size of the generated image.

Deprecated since: 2.14.

Use `rsvg_handle_render_document()` instead. This function was deprecated because when the `size_func` is used, it makes it unclear when the librsvg functions which call the `size_func` will use the size computed originally, or the callback-specified size, or whether it refers to the whole SVG or to just a sub-element of it. It is easier, and unambiguous, to use code similar to the example above.

#### Parameters

`size_func`

  Type: `RsvgSizeFunc`

  A sizing function, or `NULL`

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  User data to pass to `size_func`, or `NULL`

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`user_data_destroy`

  Type: `GDestroyNotify`

  Function to be called to destroy the data passed in `user_data`, or `NULL`.