Example #1
0
 private function processStream(PHPRtfLite_Writer_Interface $streamOutput)
 {
     $streamOutput->open();
     $contents = array('Hello world!', "\n", "Teststring: äüö");
     foreach ($contents as $part) {
         $streamOutput->write($part);
     }
     $this->assertEquals(implode('', $contents), $streamOutput->getContent());
 }
Example #2
0
 /**
  * sends rtf content as file attachment
  *
  * @param string $filename
  */
 public function sendRtf($filename = 'simple')
 {
     $pathInfo = pathinfo($filename);
     if (empty($pathInfo['extension'])) {
         $filename .= '.rtf';
     }
     if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
         header('Content-Disposition: filename="' . $filename . '"');
     } else {
         header('Content-Disposition: attachment; filename="' . $filename . '"');
     }
     header('Content-type: application/msword');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     $this->createWriter();
     $this->render();
     echo $this->_writer->getContent();
 }