doushih06137 2017-12-25 04:13
浏览 76
已采纳

调用未定义的方法Dompdf \ Renderer \ TableCell :: _ border_1px solid black()

i'm using dompdf for generating pdf but it is giving some wiered error

Call to undefined method Dompdf\Renderer\TableCell::_border_1px solid black() At TableCell.php (line 97)

i'm able to generate pdf with simple html (same php code)

below is my code

<?php

use Dompdf\Dompdf;


$html2 = '<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Todo</title>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">

   <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.3.0.js"></script>
  <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

  <style>

         p, strong {
            font-weight: 500 !important;
        }

        body{
          overflow-x: hidden;
        }

        .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th{
        border-width:3px;  
            border-style:outset;
        }

        .table>thead:first-child>tr:first-child>td{
           border-width:3px;  
            border-style:outset;
        }


        .table>thead:first-child>tr:first-child>th {
            border-width:3px;  
            border-style:outset;
        }

        .table>thead:first-child>tr:first-child>th {
           border-width:3px;  
            border-style:outset;
        }
   </style>

</head>

<body style="padding:40px 20px 20px 150px;">
  <div id="divModel" style="max-width: 1000px;">
    <h1 style="text-align: center;"> Proforma Invoice</h1>

    <table class="table table-bordered table-responsive">
      <thead>
        <tr>

          <td style="border-top-style:1px solid black !important;" rowspan="3" ><b>DOLPHIN SYSTEM TECHNOLOGIES</b><p>NO 6 Electronic Plaza,Shop No 322122-Dec-20173rd Floor,3rd Cross,P.R.LaneDelivery NoteMode/Terms of PaymentS.P.Road,BangaloreGSTIN/UIN: 29ABUPU2335F1Z5Suppliers Ref.Other Reference(s)E-Mail : dolphinsystech@gmail.com</p></td>
          <td style="width: 800px; "><p>Invoice No.e-Sugann No.</p><br>221</td>
          <td style="width: 500px; text-align: right;"><p>Dated</p><br>22-Dec-2017</td>

        </tr>

        <tr>


          <td style="width: 500px;height: 100px;"><p>Delivery Note.</p></td>
          <td style="width: 500px; text-align: right;"><p>Mode/Terms of Payment</p></td>

        </tr>

         <tr>

          <td style="width: 500px; "><p>Suppliers Ref.</p></td>
          <td style="width: 500px; text-align: right;"><p>Other Reference(s)</p></td>

        </tr>

         <tr>

          <td rowspan="3" style="border-bottom-style:none !important"><p>Buyer</p><b>Alliance Fitness Consultancy</b><p>No 187,New No 3,T R S Lane, Nagarthpet,</p><p>Bangalore-560002</p><p>State Name: Karnataka, Code : 29</p><p>GSTIN/UIN29AHYPM5388E1ZG</p>

          </td>
          <td style="width: 500px;height: 100px;"><p>Buyers Order No</p></td>
          <td style="width: 500px; text-align: right;"><p>Dated</p></td>

        </tr>

        <tr>

           <td style="width: 500px; "><p>Despatch Document No</p></td>
          <td style="width: 500px; text-align: right;"><p>Delivery Note Date</p></td>


        </tr>

         <tr>

          <td style="width: 800px; "><p>Despatched through</p></td>
          <td style="width: 500px; text-align: right;"><p>Destination</p></td>
        </tr>

        <tr>

           <td style="width: 500px; text-align: right;border-top-style:none !important"><p></p></td>
        <td  colspan="2" style="width:500px;border-left-style:none !important;text-align:right;"><p>Terms Of Delivary</p></td>
        </tr>
      </thead>

      </table>


    <table class="table table-bordered" style="margin-top: -20px;">

      <thead>

         <tr>
          <th style="width: 5px;">Sl NO</th>
          <th>Description of Goods</th>
          <th style="width: 10px;">HSN/SAC</th>
          <th style="width: 10px; text-align: right;">Quantity</th>
          <th style="width: 10px; text-align: right">Rate</th>
             <th style="width: 10px; text-align: right;">Per</th>
          <th style="width: 10px; text-align: right">Amount</th>
        </tr>

        <tr>
          <th style="width: 5px;">1</th>
          <th>Side Board<br><br><br>CGST<br>SGST</th>
          <th style="width: 10px;"></th>
          <th style="width: 10px; text-align: right;">1 NOS</th>
          <th style="width: 10px; text-align: right">4,000.00</th>
             <th style="width: 10px; text-align: right;">N0s</th>
          <th style="width: 10px; text-align: right">4,000.00<br> <br> 360.00<br>360.00</th>
        </tr>

         <tr>
          <th style="width: 5px;"></th>
          <th>Total</th>
          <th style="width: 10px;"></th>
          <th style="width: 10px; text-align: right;">1 N0S</th>
          <th style="width: 10px; text-align: right"></th>
             <th style="width: 10px; text-align: right;"></th>
          <th style="width: 10px; text-align: right"> 4,720.00</th>
        </tr>

          <tr>
           <th colspan="7"><p>Amount Chargeable (in words)</p><b>INR Four Thousand Seven Hundred Twenty Only</b></th>
           </tr>
         <tr>

          <th style=" border-bottom-style:none !important;">HSN/SAC</th>
          <th style="width: 10px;border-bottom-style:none !important">Taxable Value</th>
          <th colspan="2" style="width: 10px; text-align: right;">Central Tax</th>

             <th colspan="2" style="width: 10px; text-align: right;">State Tax</th>

             <th style="width: 10px;border-bottom-style:none !important; text-align: right">Total<br>Tax Amount</th>
        </tr>

         <tr>

          <th style="border-top-style:none !important"></th>
          <th style="width: 10px;border-top-style:none !important">Taxable Value</th>
          <th style="width: 10px; text-align: right;">Central Tax</th>
          <th style="width: 10px; text-align: right">Rate</th>
             <th style="width: 10px; text-align: right;">State Tax</th>
           <th style="width: 10px; text-align: right">Total<br>Tax Amount</th>
             <th style="width: 10px;border-top-style:none !important; text-align: right"></th>
        </tr>

          <tr>

          <th></th>
          <th style="width: 10px;">4000.00</th>
          <th style="width: 10px; text-align: right;"></th>
          <th style="width: 10px; text-align: right">360.00</th>
             <th style="width: 10px; text-align: right;"></th>
          <th style="width: 10px; text-align: right">360.00</th>
             <th style="width: 10px; text-align: right">720.00</th>
        </tr>

         <tr>

          <th>Total</th>
          <th style="width: 10px;">4000.00</th>
          <th style="width: 10px; text-align: right;"></th>
          <th style="width: 10px; text-align: right">360.00</th>
             <th style="width: 10px; text-align: right;"></th>
          <th style="width: 10px; text-align: right">360.00</th>
             <th style="width: 10px; text-align: right">720.00</th>
        </tr>

        <tr>
          <th colspan="7" style=" border-bottom-style:none !important;padding-bottom: 100px;"><p>Tax Amount (in words)</p><b>INR Seven Hundread And Twenty Only</b></th>
        </tr>


        <tr>

          <th colspan="2" style="border-top-style:none !important">
          <p>Declaration</p>

         <p>We declare that this invoice shows <br> the actual price of thegoods described <br>and that all particulars are true and <br>correct</p></th>

          <th colspan="7"> 

             <p>for DOLPHIN SYSTEM TECHNOLOGIES</p>

             <p><br>Authorised Signatory</p>

          </th>


        </tr>



      </thead>


    </table>
  </div>

</body>

</html>';   

        $dompdf = new Dompdf();
        $dompdf->loadHtml($html2);  

        // (Optional) Setup the paper size and orientation
        $dompdf->setPaper('A4', 'landscape');

        // Render the HTML as PDF
        $dompdf->render();

        // Output the generated PDF to Browser
        //$dompdf->stream();

         //$dompdf->render();
         $output = $dompdf->output();

         $publicPath = public_path();

         $filePath = $publicPath.'/generated_pdf/downlaod.pdf';

         file_put_contents($filePath, $output); 


    ?>
  • 写回答

1条回答 默认 最新

  • dongwu9647 2017-12-25 06:45
    关注

    The problem is here:

    <td style="border-top-style:1px solid black !important;"
    

    You're not using correct CSS syntax here and that's why Dompdf renderer gives you the error. You should do something like this to make it work:

    <td style="border-top-style: solid"
    

    https://www.w3schools.com/cssref/pr_border-top_style.asp

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上