<?php

        try{

        #GET LIBRARY
        require('fpdf.php');
        #GET LIBRARY

        $pdf     = new Fpdf();
        header('content-type:image/jpeg');

        for($a = 1; $a<3; $a++)
        {
                $source               = $_SERVER['DOCUMENT_ROOT']."/assets/kprint/pn/image_".$a."_sinhala.jpg";

                $image                = imagecreatefromjpeg($source);

                $font                 = $_SERVER['DOCUMENT_ROOT']."/assets/kprint/font/OpenSans-Regular.ttf";
                $color                = imagecolorallocate($image,0,0,0);

                //$data_all             = DB::table('savings')->where('id',$core_id)->first();

                switch($a)
                {
                    case 1:

                $data_1             = $date;
                $data_2             = $membership_number;

                $data_4             = $amount;

                $data_5             = $member_1_address;
                $data_6             = $member_1_name;
                $data_7             = $member_1_nic;

                $data_8             = $member_2_address;//"data 8 page 2";
                $data_9             = $member_2_name;//"data 9 page 2";
                $data_10            = $member_2_nic;//"data 10 page 2";

                $data_11            = $member_3_address;//"data 11 page 2";
                $data_12            = $member_3_name;//"data 12 page 2";
                $data_13            = $member_3_nic;//"data 13 page 2";

                $data_14            = $member_4_address;//"data 14";
                $data_15            = $member_4_name;//"data 15";
                $data_16            = $member_4_nic;//"data 16 page 2";

                $data_17            = $borrower_address;//"data 17 page 2";
                $data_18            = $borrower_name;//"data 18 page 2";
                $data_19            = $borrower_nic;//"data 19 page 2";
                $data_20            = $amount_from_word;//"data 20 page 2";

                $data_21            = $amount;//"data 21";
                $data_22            = $date;//"data 22";
                $data_23            = $amount_from_word;//"23";
                $data_24            = $amount;//"data 24";
                $data_25            = $interest_amount;//"data 25";
                $data_26            = $interest_word;//"26";
                $data_27            = $stamp_value;//"data 27";
                $data_28            = $amount_from_word;//"data 28";
                $data_29            = $amount;//"29";

                $data_30            = date("Y");
                $data_31            = $month_of;
                $data_32            = $day_of;

//                 $data_1             = "data 1 page 2";
//                 $data_2             = "data 2 page 2";
//                 $data_3             = "data 3 page 2";
//                 $data_4             = "data 4 page 2";
//                 $data_5             = "data 5 page 2";
//                 $data_6             = "data 6 page 2";
//                 $data_7             = "data 7 page 2";
//                 $data_8             = "data 8 page 2";
//                 $data_9             = "data 9 page 2";
//                 $data_10            = "data 10 page 2";
//                 $data_11            = "data 11 page 2";
//                 $data_12            = "data 12 page 2";
//                 $data_13            = "data 13 page 2";
//                 $data_14            = "data 14";
//                 $data_15            = "data 15";
//                 $data_16            = "data 16 page 2";
//                 $data_17            = "data 17 page 2";
//                 $data_18            = "data 18 page 2";
//                 $data_19            = "data 19 page 2";
//                 $data_20            = "data 20 page 2";
//
//                 $data_21            = "data 21";
//                 $data_22            = "data 22";
//                 $data_23            = "23";
//                 $data_24            = "data 24";
//                 $data_25            = "data 25";
//                 $data_26            = "26";
//                 $data_27            = "data 27";
//                 $data_28            = "data 28";
//                 $data_29            = "29";
//
//                 $data_30            = "30";
//                 $data_31            = "31";
//                 $data_32            = "32";

                imagettftext($image,37,0,2230,190,$color,$font,$data_1);
                imagettftext($image,37,0,2200,310,$color,$font,$data_2);
//                 imagettftext($image,37,0,2480,345,$color,$font,$data_3);

                imagettftext($image,37,0,1400,315,$color,$font,$data_4);

                imagettftext($image,37,0,420,950,   $color,$font,$data_5);
                imagettftext($image,37,0,420,1040,$color,$font,$data_6);

                imagettftext($image,37,0,1850,1040,$color,$font,$data_7);
                imagettftext($image,37,0,420,1180,$color,$font,$data_8);

                imagettftext($image,37,0,420,1250,$color,$font,$data_9);
                imagettftext($image,37,0,1850,1250,$color,$font,$data_10);

                imagettftext($image,37,0,420,1390,$color,$font,$data_11);
                imagettftext($image,37,0,420,1465,$color,$font,$data_12);

                imagettftext($image,37,0,1850,1465,$color,$font,$data_13);
                imagettftext($image,37,0,420,1600,$color,$font,$data_14);

                imagettftext($image,37,0,420,1680,$color,$font,$data_15);
                imagettftext($image,37,0,1850,1680,$color,$font,$data_16);


                imagettftext($image,37,0,1500,1870,$color,$font,$data_17);
                imagettftext($image,37,0,910,1940,$color,$font,$data_18);


                imagettftext($image,37,0,375,2010,$color,$font,$data_19);
                imagettftext($image,37,0,2040,2010,$color,$font,$data_20);



                imagettftext($image,37,0,420,2080,$color,$font,$data_21);


                imagettftext($image,37,0,1450,2080,$color,$font,$data_22);
                imagettftext($image,37,0,850,2290,$color,$font,$data_23);

                imagettftext($image,37,0,1800,2290,$color,$font,$data_24);
                imagettftext($image,37,0,1540,2555,$color,$font,$data_25);

                imagettftext($image,37,0,1900,2555,$color,$font,$data_26);
                imagettftext($image,37,0,1100,2630,$color,$font,$data_27);


                imagettftext($image,37,0,850,2820,$color,$font,$data_28);
                imagettftext($image,37,0,1920,2820,$color,$font,$data_29);

                imagettftext($image,37,0,2090,3240,$color,$font,$data_30);
                imagettftext($image,37,0,2450,3240,$color,$font,$data_31);
                imagettftext($image,37,0,350,3300,$color,$font,$data_32);


                    break;
                   case 2:




                    break;

                }



                imagejpeg($image,$_SERVER['DOCUMENT_ROOT'].'/assets/kprint/update/pn_agreement_'.$a.$core_id.'.jpg', 50);

                $pdf->AddPage();
                $pdf->Image($_SERVER['DOCUMENT_ROOT'].'/assets/kprint/update/pn_agreement_'.$a.$core_id.'.jpg',10,10,189);

        }

        $pdf->Output();
        exit;


        }
        catch(Exception $e)
        {
            echo $e->getMessage();
        }



?>