manua has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I am making my table table using, PDF::API2 and PDF::Table. If I fix the cloumn width with min_w, lot of space is wasted. Is there a way I can make the table couloumns to autofit the content.

Thanks
  • Comment on Autofit Table coloumns using PDF::Table

Replies are listed 'Best First'.
Re: Autofit Table coloumns using PDF::Table
by stefbv (Priest) on Feb 18, 2010 at 19:10 UTC

    From the PDF::Table module docs:

    If the 'min_w' parameter is used for 'col_props', have in mind that it can be overwritten by the calculated minimum cell width if the userdefined value is less that calculated.

    By setting 'min_w' to 0, it will be overwritten by the calculated minimum cell width, isn't this equivalent with autofit?

    I tested with the sample script from the module's source distribution an it looks like it's working...