Blame view

export/PHPRtfLite-1.3.1/samples/utf8.php 572 Bytes
f90e19c3   Andrea Petta   plugin update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  <?php
  
  $dir = dirname(__FILE__);
  require_once $dir . '/../lib/PHPRtfLite.php';
  
  // register PHPRtfLite class loader
  PHPRtfLite::registerAutoloader();
  
  //Rtf document
  $rtf = new PHPRtfLite();
  
  //Font
  $times12 = new PHPRtfLite_Font(12, 'Times new Roman');
  
  //Section
  $sect = $rtf->addSection();
  //Write utf-8 encoded text.
  //Text is from file. But you can use another resouce: db, sockets and other
  $sect->writeText(file_get_contents($dir . '/sources/utf8.txt'), $times12, null);
  
  // save rft document
  $rtf->save($dir . '/generated/' . basename(__FILE__, '.php') . '.rtf');