Horde_Pdf_Writer::save PHP Method

save() public method

Saves the PDF file on the filesystem.
public save ( string $filename = 'unknown.pdf' )
$filename string The filename for the output file.
    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);
    }