Skip to content

Table Issues #90

@Manuzza

Description

@Manuzza

For over a year we have been trying to use (in production) the new versions of the PDF classes but we simply can't. The show stopper is the unreliability of table generation when tables have a lot of data in them. In short, sometimes the table engine calculates a column width so narrow text cannot fit so it wraps to the next page, then the next page, and so on until the PODF generation exceeds the PHP time limit OR the process runs out of RAM (which ever comes first). This breaks a LOT of our code in production.

Whilst we sometimes have the problem with the old classes the problem is very frequent with the new.

A year ago I submitted a solution to this problem but part of it was rejected. I would like to resubmit this as we need to have this implemented in order to use the classes. We have hundreds of PDF tables and sometimes it requires data with a length that we have not seen before and suddenly a working table fails, bringing production processing down with it. For example, we may suddenly get a email address that is a ridiculous width, and all of a sudden we have a problem.

The code that was submitted (and accepted) was the "evenColumns" feature in the table configuration. The feature that was rejected was to have this turn on automatically if any of the columns became too narrow.

The feature currently works as follows:
If "evenColumns" = 0 (default) it is turned off
If "evenColumns" = 1 it is turned on

The new feature works like this:
If "evenColumns" = 2 then evenColumns is automatically turned on IF one of the columns is too narrow
Additional table option "evenColumnsMin" (default = 20?) is the minimum acceptable width for any column.

There are two code changes. In the ezTable function we need to add the new default value. For example:
'evenColumns' => 0, 'evenColumnsMin' => 20

The following code needs to be inserted immediately before the following lines:

        // if the option is turned on we need to look at recalculating the columns
        if ($options['evenColumns'] == 1) {

The new code is:

        // if the option is set to 2 and one of the columns is too narrow we need to look at recalculating the columns
        if ($options['evenColumns'] == 2) {
            $posVals = array();
            foreach ($pos as $w)
                array_unshift($posVals, $w);
            $narrowestCol = 9999;
            $last = array_pop($posVals);
            while (sizeof($posVals)) {
                $current = array_pop($posVals);
                $currentWidth = $current - $last;
                if ($narrowestCol > $currentWidth)
                    $narrowestCol = $currentWidth;
                $last = $current;
            }
            if ($narrowestCol < $options['evenColumnsMin'])
                $options['evenColumns'] = 1;
        }

Is it possible to have this added to the core libraries? Please?

Murray

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions