Welcome Guest, Not a member yet? Register   Sign In
calling library function stops foreach loop

I am building a app that requires the production of pdf files. I am using FPDF and FPDI. Sometimes the app requires the calling of the library class multiple times in the form a foreach loop. But everytime when I am in need of multiple calls it stops after the first one. Also the library class seems to refresh to a blanck window.

If anyone can produce a logical explenation I would be very happy.

PHP Code:
('BASEPATH') OR exit('No direct script access allowed');

 * Maak een pdf
class CreatePdf
     * Maak de pdf
     * @param $data collectie van input data
     * @param $sourceFile basis pdf bestands locatie
     *  */ 
    public function create($data$sourceFile)

        // initializeer FPDI in ladnscape 
        // $pdf = new Fpdi('L');
        $pdf = new PDF_TextBox('L');

        // Nieuwe pagina
        $tpl $pdf->importPage(1);

        /* Gebruik de nieuwe pagina als een template op de achtergrond
         * Dit met de volledige breedte en hoogte */

        // Set font en kleur

        foreach($data['single'] as $single)
            $pdf->Text($single[0], $single[1], $single[2]);

        foreach($data['textbox'] as $textbox)
            $pdf->SetXY($textbox[0], $textbox[1]);
            $pdf->drawTextBox($textbox[2], $textbox[3], $textbox[4], $textbox[5], $textbox[6], $textbox[7]);

        /* Output our new pdf into a file
         * F = Write local file
         * I = Send to standard output (browser)
         * D = Download file
         * S = Return PDF as a string */
        $pdf->Output(APPPATH '../docs/s627-'date("d-m-Y-H.i.s") .'.pdf''F');   

PHP Code:
     * Verzamel alle data en creeër de documenten
    public function create_s627()
        $input $this->collectInput();
            $sourceFiles $this->getSourceFiles($input['checkbox']);
            foreach($sourceFiles as $sourceFile)
            echo "Data was leeg";
Array of sourcefile
array(3) {
  string(31) "./assets/base/S627-bis-lvhw.pdf"
  string(29) "./assets/base/S627-bis-wl.pdf"
  string(22) "./assets/base/S627.pdf"

Are you sure collectInput always return the expected data?
Your code is probably crashing on a fatal error. Check your log files.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/

The issue was with the speed of wich the files where created. I was in the assumption that using a time based name of the file was the smart way to go. But the file was just overwritten by the one created after it.

So the name of the game was using the name of the start pdf in the actual name.

As for the blanck page. If you don't tell the method to redirect or load new pages it goes blanck

Theme © iAndrew 2016 - Forum software by © MyBB