Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf option is not working #3

Open
krishmurali77 opened this issue Jul 12, 2018 · 2 comments
Open

pdf option is not working #3

krishmurali77 opened this issue Jul 12, 2018 · 2 comments

Comments

@krishmurali77
Copy link

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
Copy link

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
Copy link

thanks-- it fixed my issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants