public function save($filename = 'unknown.pdf')
{
// Check whether the buffer has been flushed already.
if ($this->_flushed) {
throw new Horde_Pdf_Exception('The buffer has been flushed already, don\'t use save() in combination with flush().');
}
// Check whether file has been closed.
if ($this->_state < 3) {
$this->close();
}
$f = fopen($filename, 'wb');
if (!$f) {
throw new Horde_Pdf_Exception(sprintf('Unable to save Pdf file: %s', $filename));
}
fwrite($f, $this->_buffer, strlen($this->_buffer));
fclose($f);
}