Menu

html support

Help
2015-01-11
2015-01-12
  • Gerry Danen

    Gerry Danen - 2015-01-11

    I would like to import html templates that, with some variable replacements, can be written directly to the pdf document.

    These templates involve html tables, but I cannot get the horizontal spacing right. I tried fixed width, percentages, in css and in the table, but the results are not what I need.

    Are there rules, as to how TCPDF interpretes html? Is there a documentation file I missed?

    Thanks for your help.

    Gerry

     

    Last edit: Gerry Danen 2015-01-11
  • Simon

    Simon - 2015-01-11

    I do this but I do all my measurements in mm. eg.

    <table width="150mm">
    
     
    • Gerry Danen

      Gerry Danen - 2015-01-12

      Do you use <style></style> or hardcode in the html, Simon?

       
  • Simon

    Simon - 2015-01-12

    I hardcode.

     
    • Gerry Danen

      Gerry Danen - 2015-01-12

      Thanks, Simon.

      I have tinkered with some code and this works for me:

      <style>
          .transmittalViewItems {
              border-collapse: collapse;
              border-spacing: 0px;
              width: 100%;
              margin: 0px;
              padding: 0px;
              font-size: 12px;
          }
          .transmittalViewItems td {
              padding: 1px 5px 2px 5px;
          }
      
          .columnLeft {
              text-align: left;
              vertical-align: top;
          }
          .columnCenter {
              text-align: center;
              vertical-align: top;
          }
          .column1 { width:  4%; }
          .column2 { width: 19%; }
          .column3 { width:  4%; }
          .column4 { width:  4%; }
          .column5 { width: 21%; }
          .column6 { width: 21%; }
          .column7 { width: 27%; }
      </style>
      <table class="transmittalViewItems">
          <tbody>
          <tr>
              <th class="columnCenter column1">No</th>
              <th class="columnLeft   column2">Design</th>
              <th class="columnCenter column3">Sh</th>
              <th class="columnCenter column4">Rev</th>
              <th class="columnLeft   column5">Thermon Document</th>
              <th class="columnLeft   column6">Client Document</th>
              <th class="columnLeft   column7">Title</th>
          </tr>
          <tr>
              <td class="columnCenter column1">$documentCount</td>
              <td class="columnLeft   column2">$zoneNumber</td>
              <td class="columnCenter column3">$sheet</td>
              <td class="columnCenter column4">$rev</td>
              <td class="columnLeft   column5">$thermonDrawing</td>
              <td class="columnLeft   column6">$clientDrawing</td>
              <td class="columnLeft   column7">$title</td>
          </tr>
          </tbody>
      </table>
      
       

Log in to post a comment.