protected function _check_callbacks($event, $frame)
    {
        if (!isset($this->_callbacks)) {
            $dompdf = $this->_frame->get_dompdf();
            $this->_callbacks = $dompdf->get_callbacks();
            $this->_canvas = $dompdf->get_canvas();
        }

        if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) {
            $info = array(
                0 => $this->_canvas, "canvas" => $this->_canvas,
                1 => $frame,         "frame"  => $frame,
            );
            $fs = $this->_callbacks[$event];
            foreach ($fs as $f) {
                if (is_callable($f)) {
                    if (is_array($f)) {
                        $f[0]->{$f[1]}($info);
                    } else {
                        $f($info);
                    }
                }
            }
        }
    }