[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/www/se3/html2pdf/examples/ -> bookmark.php (source)

   1  <?php
   2  /**
   3   * HTML2PDF Librairy - example
   4   *
   5   * HTML => PDF convertor
   6   * distributed under the LGPL License
   7   *
   8   * @author      Laurent MINGUET <webmaster@html2pdf.fr>
   9   *
  10   * isset($_GET['vuehtml']) is not mandatory
  11   * it allow to display the result in the HTML format
  12   */
  13  
  14  ob_start();
  15  ?>
  16  <style type="text/css">
  17  <!--
  18      table.page_header {width: 100%; border: none; background-color: #DDDDFF; border-bottom: solid 1mm #AAAADD; padding: 2mm }
  19      table.page_footer {width: 100%; border: none; background-color: #DDDDFF; border-top: solid 1mm #AAAADD; padding: 2mm}
  20      h1 {color: #000033}
  21      h2 {color: #000055}
  22      h3 {color: #000077}
  23  
  24      div.niveau
  25      {
  26          padding-left: 5mm;
  27      }
  28  -->
  29  </style>
  30  <page backtop="14mm" backbottom="14mm" backleft="10mm" backright="10mm" style="font-size: 12pt">
  31      <page_header>
  32          <table class="page_header">
  33              <tr>
  34                  <td style="width: 100%; text-align: left">
  35                      Exemple d'utilisation des bookmarks
  36                  </td>
  37              </tr>
  38          </table>
  39      </page_header>
  40      <page_footer>
  41          <table class="page_footer">
  42              <tr>
  43                  <td style="width: 100%; text-align: right">
  44                      page [[page_cu]]/[[page_nb]]
  45                  </td>
  46              </tr>
  47          </table>
  48      </page_footer>
  49      <bookmark title="Sommaire" level="0" ></bookmark>
  50  </page>
  51  <page pageset="old">
  52      <bookmark title="Chapitre 1" level="0" ></bookmark><h1>Chapitre 1</h1>
  53      <div class="niveau">
  54          Contenu du chapitre 1
  55      </div>
  56  </page>
  57  <page pageset="old">
  58      <bookmark title="Chapitre 2" level="0" ></bookmark><h1>Chapitre 2</h1>
  59      <div class="niveau">
  60          intro au chapitre 2
  61          <bookmark title="Chapitre 2.1" level="1" ></bookmark><h2>Chapitre 2.1</h2>
  62          <div class="niveau">
  63              Contenu du chapitre 2.1
  64          </div>
  65          <bookmark title="Chapitre 2.2" level="1" ></bookmark><h2>Chapitre 2.2</h2>
  66          <div class="niveau">
  67              Contenu du chapitre 2.2
  68          </div>
  69          <bookmark title="Chapitre 2.3" level="1" ></bookmark><h2>Chapitre 2.3</h2>
  70          <div class="niveau">
  71              Contenu du chapitre 2.3
  72          </div>
  73      </div>
  74  </page>
  75  <page pageset="old">
  76      <bookmark title="Chapitre 3" level="0" ></bookmark><h1>Chapitre 3</h1>
  77      <div class="niveau">
  78          intro au chapitre 3
  79          <bookmark title="Chapitre 3.1" level="1" ></bookmark><h2>Chapitre 3.1</h2>
  80          <div class="niveau">
  81              Contenu du chapitre 3.1
  82          </div>
  83          <bookmark title="Chapitre 3.2" level="1" ></bookmark><h2>Chapitre 3.2</h2>
  84          <div class="niveau">
  85              intro au chapitre 3.2
  86              <bookmark title="Chapitre 3.2.1" level="2" ></bookmark><h3>Chapitre 3.2.1</h3>
  87              <div class="niveau">
  88                  Contenu du chapitre 3.2.1
  89              </div>
  90              <bookmark title="Chapitre 3.2.2" level="2" ></bookmark><h3>Chapitre 3.2.2</h3>
  91              <div class="niveau">
  92                  Contenu du chapitre 3.2.2
  93              </div>
  94          </div>
  95      </div>
  96  </page>
  97  <?php
  98      $content = ob_get_clean();
  99  
 100      require_once(dirname(__FILE__).'/../html2pdf.class.php');
 101      try
 102      {
 103          $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
 104          $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
 105          $html2pdf->createIndex('Sommaire', 25, 12, false, true, 1);
 106          $html2pdf->Output('bookmark.pdf');
 107      }
 108      catch(HTML2PDF_exception $e) {
 109          echo $e;
 110          exit;
 111      }


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1