supports_mime_type#

Returns 1 if the surface can embed data of the given MIME type unchanged in its output, and 0 if it cannot.

if ($pdf->supports_mime_type(Cairo::Surface::MIME_TYPE_JPEG)) { $image->set_mime_data(Cairo::Surface::MIME_TYPE_JPEG, $jpeg); }

Worth asking before set_mime_data, since attaching data a backend cannot use just wastes memory. Wraps cairo_surface_supports_mime_type.