plugins/fitcolumn.js
function (table) {
        if (!table.pdf.page) {
            return;
        }
        if (this.calculatedWidth === null) {
            var self = this,
                content_width = this.maxWidth,
                width = lodash.sumBy(table.getColumns(), function (column) {
                    return column.id !== self.column ? column.width : 0;
                });

            if (!content_width) {
                content_width = table.pdf.page.width
                    - table.pdf.page.margins.left
                    - table.pdf.page.margins.right;
            }

            this.calculatedWidth = content_width - width;
            if (this.calculatedWidth < 0) {
                this.calculatedWidth = 0;
            }
        }
        table.setColumnWidth(this.column, this.calculatedWidth, true);
    }
function (table) {
        if (!table.pdf.page) {
            return;
        }
        if (this.calculatedWidth === null) {
            var self = this,
                content_width = this.maxWidth,
                width = lodash.sumBy(table.getColumns(), function (column) {
                    return column.id !== self.column ? column.width : 0;
                });

            if (!content_width) {
                content_width = table.pdf.page.width
                    - table.pdf.page.margins.left
                    - table.pdf.page.margins.right;
            }

            this.calculatedWidth = content_width - width;
            if (this.calculatedWidth < 0) {
                this.calculatedWidth = 0;
            }
        }
        table.setColumnWidth(this.column, this.calculatedWidth, true);
    }
function ( table ) { if ( ! table . pdf . page ) { return ; } if ( this . calculatedWidth === null ) { var self = this , content_width = this . maxWidth , width = lodash . sumBy ( table . getColumns ( ) , function ( column ) { return column . id !== self . column ? column . width : 0 ; } ) ; if ( ! content_width ) { content_width = table . pdf . page . width - table . pdf . page . margins . left - table . pdf . page . margins . right ; } this . calculatedWidth = content_width - width ; if ( this . calculatedWidth < 0 ) { this . calculatedWidth = 0 ; } } table . setColumnWidth ( this . column , this . calculatedWidth , true ) ; }
Check the max width of the stretched column. This method is called just
before we start to add data rows

@param {PdfTable} table
@return {void}
Check the max width of the stretched column . This method is called just before we start to add data rows