0

I'm currently working with PDFLib 9.0.5 with PHP and I'm truggling with the building of a table.

I've got a large table with 34 columns. The first thing I do is create the header row and i've got this error message

PDFlibException' with message 'Cell in column(s) 33 and row(s) 1: Illegal array index 32 in function pdc_bvtr_setbit

I've made a test with 32 columns and there is no problems. If the array i'm using to create the row is larger than 32 elements, i've got the error.

I thought it could be due to a lack of space whithin my pdf, so i increase the pdf's width but it didn't change anything.

Here is the code which triggered the error :

foreach($this->headerTable as $index=>$text)
{
    $currentOption=$optlist;
    if(is_int($index))
    {
        $currentColorString=(($col%2)==0)?$alternateWhiteColorString:$whiteColorString;
        $currentOption.=(in_array($index,array(2,3)))?' fittextflow={orientate=west}':'';
        $currentOption.=($index==5)?' fittextflow={stamp=ll2ur}':'';
        $currentOption.=(in_array($index,array(0,1,4)))?' fittextflow={stamp=ll2ur}':'';
    }
    else
    {
        $currentColorString=(($col%2)==0)?$greyColorString:$greyAlternateColorString;
        $text=$index.' ('.$text.')';
        $currentOption.=' fittextflow={stamp=ll2ur}';
    }
    $textFlow=PDF_add_textflow($this->pdf,0,$text,$optionHeaderContent);
    $this->table=PDF_add_table_cell($this->pdf,$this->table,$col,1,'',$currentOption.' matchbox={fillcolor={rgb '.$currentColorString.'}} textflow='.$textFlow);
    ++$col;
}
  • 32 is a round number (in binary), so it is a possible limit of the library. There may also be a setting where you can increase this. 33 columns is quite a large number to fit on a page, so the creators may have thought it was enough. Will it allow you to put tables inside of cells - if so that might be a crude workround – Graham Jul 13 '15 at 10:32
  • @Graham you right, after 30 columns, it's hardly fit on a A4 page. However, how do you explain the error is still there if I increase the page width ? – Benjamin Lemin Jul 13 '15 at 15:33
  • @Benjamin-Lemin this is bug in the current version of PDFlib 9.0.5. It should be fixed in the next release. – Rainer Jul 14 '15 at 11:17
  • @Rainer thank you very much for the intel. I should thought about checking the bug list. – Benjamin Lemin Jul 14 '15 at 12:00

1 Answers1

1

Answer from Rainer comment : this is bug in the current version of PDFlib 9.0.5. It should be fixed in the next release.