Blame view

export/PHPRtfLite-1.3.1/docs/html/_sources/images.txt 1.17 KB
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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  .. _images:
  
  Images
  ********************
  
  In PHPRtfLite you can add images to headers and footers, to table cells, and sections.
  
  
  Image resize
  ====================
  
  You can specify the width and the height of the image in the RTF document. Note, that adding large images will cause large RTF documents, even if the images is scaled down by RTF.
  
  .. code-block:: php
  
      <?php
      $imageFile = '/path/to/image/file';
      $image = $section->addImage($imageFile);
      // width to 1cm
      $image->setWidth(1);
      // height to 1cm
      $image->setHeight(1);
  
  
  Image border
  ====================
  
  .. code-block:: php
  
      <?php
      $border = new PHPRtfLite_Border(
          $rtf,                                       // PHPRtfLite instance
          new PHPRtfLite_Border_Format(2, '#00FF00'), // left border: 2pt, green color
          new PHPRtfLite_Border_Format(1, '#FFFF00'), // top border: 1pt, yellow color   
          new PHPRtfLite_Border_Format(2, '#FF0000'), // right border: 2pt, red color
          new PHPRtfLite_Border_Format(1, '#0000FF')  // bottom border: 1pt, blue color
      );
      // image with border
      $image->setBorder($border);
  
  Read more about creating borders here: :ref:`borders`.