FPDF undefined index foreach

Im trying to generate report using PFDF. Im getting an error undefined index in my array if im trying to convert it to PDF cell. but if i just plain ECHO it there is no error in my array.

 if($data['permitinfo']){
        foreach ($data['permitinfo'] as $key => $value) {
            $pdf->SetFont('Century Gothic','B',8); 
            $pdf->setDrawColor(189, 195, 199);
            $pdf->AddPage();
            $pdf->Cell(0,5, 'EXAMINATION PERMIT ('.$value['periodname'].')',0,0,'C');
            $pdf->Ln(4);
            $pdf->Cell(0,5, $value['gradingperiod'].' (Enroll No. '.$value['enrollno'].')',0,0,'C');
            $pdf->Ln(5);

            $pdf->SetFont('Century Gothic','B',8); 
            $pdf->Cell(20,5, 'ID Number',0,0,'L');
            $pdf->SetFont('Century Gothic','',8); 
            $pdf->Cell(26,5, ': '.$value['idno'],0,0,'L');
            $pdf->SetFont('Century Gothic','B',8); 
            $pdf->Cell(26,5, 'Course/Yr.',0,0,'R');
            $pdf->SetFont('Century Gothic','',8); 
            $pdf->Cell(33,5, ': '.$value['coursecode'].'-'.$value['year'],0,0,'L');
            $pdf->Ln(4);
            $pdf->SetFont('Century Gothic','B',8); 
            $pdf->Cell(20,5, 'Name',0,0,'L');
            $pdf->SetFont('Century Gothic','',8); 
            $pdf->Cell(83,5, ': '.iconv("UTF-8", "ISO-8859-1", $value['fullname']),0,0,'L');
            $pdf->Ln(4);
            $pdf->SetFont('Century Gothic','B',8); 
            $pdf->Cell(52,5, 'SUBJECTS',0,0,'L');
            $pdf->Cell(16,5, '',0,0,'R');
            $pdf->Cell(36,5, 'PROCTOR',0,0,'C');
            $pdf->Ln(4);
            $pdf->setDrawColor(0, 0, 0);
            $pdf->Cell(0,1, '','B',1,'C');
            $pdf->Ln(2);
            $pdf->SetFont('Century Gothic','',8);
            foreach ($value['subjects'] as $k => $v) {
                $pdf->Cell(52,4, $v['subcode'],0,0,'L');
                $pdf->Cell(16,4, '',0,0,'R');
                $pdf->Cell(36,4, '______________________','0',0,'C');
                $pdf->Ln(4);
            }
        }

whith this code im getting an error

Notice: Undefined index: subjects in E:\newprojects\siams\app\views\studentledger\printpermitbatch.php on line 150

Warning: Invalid argument supplied for foreach() in E:\newprojects\siams\app\views\studentledger\printpermitbatch.php on line 150

Notice: Undefined index: subjects in E:\newprojects\siams\app\views\studentledger\printpermitbatch.php on line 150

Warning: Invalid argument supplied for foreach() in E:\newprojects\siams\app\views\studentledger\printpermitbatch.php on line 150 

but if trying to just echo it like this, im getting the correct output of the array

 if($data['permitinfo']){
        foreach ($data['permitinfo'] as $key => $value) {

            echo $value['fullname'].'<br>';

            foreach ($value['subjects'] as $k => $v) {
                echo '.....'.$v['subcode'].'<br>';
            }
        }
    }

the result looks like this which is the correct output , i just need to convert it to pdf cell

ABAD, CHANGMI DAYE HITALIA
   .....CADL
   .....CE 211
   .....CE 211L
   .....CE 212
   .....CFE 3
   .....ENGMATH 4

my raw array looks like this

Array
(
[0] => Array
    (
        [periodname] => First Semester, 2019-2020
        [gradingperiod] => PRELIM
        [idno] => 19100505
        [fullname] => ALCANTARA, ALEXANDREA MAE  VIDAL
        [coursecode] => BS ARCH
        [year] => 1
        [enrollno] => 2966
        [subjects] => Array
            (
                [0] => Array
                    (
                        [subcode] => AR A111
                        [subdesc] => ARCHL DESIGN 1-INTRODUCTION TO DESIGN
                        [units] => 1
                    )

                [1] => Array
                    (
                        [subcode] => AR A111D
                        [subdesc] => ARCHL DESIGN 1-INTRODUCTION TO DESIGN
                        [units] => 1
                    )

                [2] => Array
                    (
                        [subcode] => AR A112
                        [subdesc] => ARCHL VISUAL COMMUNICATIONS 2-VISUAL TECHNIQUES 1
                        [units] => 1
                    )

                [3] => Array
                    (
                        [subcode] => AR A112D
                        [subdesc] => ARCHL VISUAL COMMUNICATIONS 2-VISUAL TECHNIQUES 1
                        [units] => 1
                    )

                [4] => Array
                    (
                        [subcode] => AR A113
                        [subdesc] => ARCHL VISUAL COMMUNICATIONS 1- GRAPHICS 1
                        [units] => 1
                    )

                [5] => Array
                    (
                        [subcode] => AR A113D
                        [subdesc] => ARCHL VISUAL COMMUNICATIONS 1- GRAPHICS 1
                        [units] => 2
                    )

            )

    )

)