(Download PDF) Works in WAMP but not in Production

Hello, I found this software last week and began working it into my client’s website. I’ve studied several aspects of it to learn the style of coding so I can adapt it to my client’s desires. It is very malleable; well done!

Problem: I developed the pdf invoice_template views on my local server and tested it greatly. Works well. I now loaded it to my production server and checked things and found an “Undefined index: miw” error in the browser and several lines of other issues in the log.

Research: the undefined index: miw was reported several times here in the support section and they appear to be related to the margins. Not sure if that is relevant to my case since it works in WAMP and not production.

UPDATE: I commented out the line 20819 to test it on the production side. It works but I imagine that is not the proper fix for it.

-----Versions-----
IP: 1.5.9
WAMP PHP: 7.2.14
Production PHP: 7.2

Thanks for any help you can provide on this.

NOTE: The non well formed numeric value encountered error seems to be consequential as I saw it before when debugging other matters during development.

ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> A non well formed numeric value encountered /homepages/10/d160958090/htdocs/bc/application/views/invoice_templates/pdf/InvoicePlane.php 140
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:04 --> Severity: Notice --> Undefined index: miw /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 20819
ERROR - 2019-09-05 20:37:05 --> Severity: error --> Exception: Data has already been sent to output, unable to output PDF file /homepages/10/d160958090/htdocs/bc/vendor/mpdf/mpdf/src/Mpdf.php 9292
ERROR - 2019-09-05 20:37:05 --> Severity: Warning --> Cannot modify header information - headers already sent by (output started at /homepages/10/d160958090/htdocs/bc/vendor/codeigniter/framework/system/core/Exceptions.php:271) /homepages/10/d160958090/htdocs/bc/vendor/codeigniter/framework/system/core/Common.php 564

A better edit would be something like

   if (!array_key_exists('miw', $c) {
       $c['miw'] /= $k;
   }
1 Like

Thank you. I updated it and it is working.

Now to continue developing.

After more development I found what is throwing the miw index error for me anyway. I noticed tonight when adding custom fields to a pdf output and if the field was empty, it would toss the error. so, my fix is…the not empty function of php.

Example

<tr>
					<td>Ship Via</td>
					<td><?php if (!empty($custom_fields['quote']['Ship Via'])) {echo $custom_fields['quote']['Ship Via'];} ?></td>
				</tr>
1 Like