technodweep / gst-invoice

A simple GST invoice billing software
https://technodweep.com
MIT License
52 stars 37 forks source link

pdf option is not working #3

Open krishmurali77 opened 6 years ago

krishmurali77 commented 6 years ago

Error PHP Notice – yii\base\ErrorException Undefined index: css_set_width

  1. in /home/technodw/invoicegst.technodweep.com/vendor/mpdf/mpdf/src/Tag.php at line 2179 2170217121722173217421752176217721782179218021812182218321842185218621872188 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->mpdf->GetFloatDivInfo($this->mpdf->blklvl - 1); }

                if ($r_exists) {
                    $currblk['margin_right'] += $r_width;
                }
    
                $currblk['float'] = 'R';
                $currblk['float_start_y'] = $this->mpdf->y;
                if ($currblk['css_set_width']) {
                    $currblk['margin_left'] = $container_w - ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
                    $currblk['float_width'] = ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
                } else {
                    // *** If no width set - would need to buffer and keep track of max width, then Right-align if not full width
                    // and do borders and backgrounds - For now - just set to maximum width left
    
                    if ($l_exists) {
                        $currblk['margin_left'] += $l_width;
                    }
  2. in /home/technodw/invoicegst.technodweep.com/vendor/mpdf/mpdf/src/Tag.php at line 2179 – yii\base\ErrorHandler::handleError(8, 'Undefined index: css_set_width', '/home/technodw/invoicegst.techno...', 2179, ...) 2173217421752176217721782179218021812182218321842185 if ($r_exists) { $currblk['margin_right'] += $r_width; }

                $currblk['float'] = 'R';
                $currblk['float_start_y'] = $this->mpdf->y;
                if ($currblk['css_set_width']) {
                    $currblk['margin_left'] = $container_w - ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
                    $currblk['float_width'] = ($setwidth + $bdl + $pdl + $bdr + $pdr + $currblk['margin_right']);
                } else {
                    // *** If no width set - would need to buffer and keep track of max width, then Right-align if not full width
                    // and do borders and backgrounds - For now - just set to maximum width left
  3. in /home/technodw/invoicegst.technodweep.com/vendor/mpdf/mpdf/src/Mpdf.php at line 15045 – Mpdf\Tag::OpenTag('DIV', ['CLASS' => 'PULL-RIGHT'], [' .bootstrap-dialog .modal-hea...', 'div class="invoice-order-view"', ' ', 'div class="row"', ...], 329) 15039150401504115042150431504415045150461504715048150491505015051 } else { $attr[strtoupper($a3[1])] = trim($a3[2]); } } } } $this->tag->OpenTag($tag, $attr, $a, $i); // mPDF 6 / -- CSS-POSITION -- / if ($this->inFixedPosBlock) { $this->fixedPosBlockBBox = [$tag, $attr, $this->x, $this->y]; $this->fixedPosBlock = ''; $this->fixedPosBlockDepth = 1; }

  4. in /home/technodw/invoicegst.technodweep.com/vendor/kartik-v/yii2-mpdf/Pdf.php at line 381 – Mpdf\Mpdf::WriteHTML(' .bootstrap-dialog .modal-hea...', 2) 375376377378379380381382383384385386387 { $api = $this->getApi(); $css = $this->getCss(); $pdfAttachments = $this->getPdfAttachments(); if (!empty($css)) { $api->WriteHTML($css, 1); $api->WriteHTML($content, 2); } else { $api->WriteHTML($content); }

    if ($pdfAttachments) {
        $api->SetImportUse();
  5. in /home/technodw/invoicegst.technodweep.com/vendor/kartik-v/yii2-mpdf/Pdf.php at line 265 – kartik\mpdf\Pdf::output('<link href="/assets/2e95b44d/css...', '', 'I') 259260261262263264265266267268269270271 { if (!empty($this->methods)) { foreach ($this->methods as $method => $param) { $this->execute($method, $param); } } return $this->output($this->content, $this->filename, $this->destination); }

    /**

    • Validates and fetches the Mpdf API instance.
    • @return Mpdf
  6. in /home/technodw/invoicegst.technodweep.com/controllers/InvoiceOrderController.php at line 212 – kartik\mpdf\Pdf::render() 206207208209210211212213214215216217218 'methods' => [ 'SetHeader' => [\Yii::$app->name], 'SetFooter' => ['{PAGENO}'], ] ]);

    return $pdf->render();

    }

    /**

    • Creates a new InvoiceOrder model by another data,
    • so user don't need to input all field from scratch.
    • If creation is successful, the browser will be redirected to the 'view' page.
  7. app\controllers\InvoiceOrderController::actionPdf('33')

  8. in /home/technodw/invoicegst.technodweep.com/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([app\controllers\InvoiceOrderController, 'actionPdf'], ['33'])

  9. in /home/technodw/invoicegst.technodweep.com/vendor/yiisoft/yii2/base/Controller.php at line 156 – yii\base\InlineAction::runWithParams(['id' => '33'])

  10. in /home/technodw/invoicegst.technodweep.com/vendor/yiisoft/yii2/base/Module.php at line 523 – yii\base\Controller::runAction('pdf', ['id' => '33'])

  11. in /home/technodw/invoicegst.technodweep.com/vendor/yiisoft/yii2/web/Application.php at line 102 – yii\base\Module::runAction('invoice-order/pdf', ['id' => '33'])

  12. in /home/technodw/invoicegst.technodweep.com/vendor/yiisoft/yii2/base/Application.php at line 380 – yii\web\Application::handleRequest(yii\web\Request)

  13. in /home/technodw/invoicegst.technodweep.com/web/index.php at line 12 – yii\base\Application::run() 6789101112 require(DIR . '/../vendor/autoload.php'); require(DIR . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(DIR . '/../config/web.php');

(new yii\web\Application($config))->run(); Yii Framework 2018-07-12, 11:00:32

Yii Framework/2.0.12

satwindersatty commented 6 years ago

if pdf is not working and you are not familiar with PHP then use this easy fix. Change the line # 2179 in vendor/mpdf/mpdf/src/Tag.php and add @ before $

it should be changed from

if ($currblk['css_set_width']) {

to

if (@$currblk['css_set_width']) {

Thank you very much Technodweep for the awesome script. Saved me a lot of time otherwise I would have to develop it from scratch. I have never worked with Yii. I only use CakePHP and Laravel. I'll use your script to learn Yii.

Thank you once again for free script. Really appreciate it :)

amenavadei commented 2 years ago

thanks-- it fixed my issues