0

Hello guys i'm a little bit confuse with my mpdf function in codeigniter to generate multiple file pdf, i tried to research and nothing can solve this is issue,

i have anchor that action to download function, and the idea is to call all function with mpdf generate in it. here is the code :

public function download($id)
    {
        $this->kehadiranDosen($id);
        $this->nilaiSeminar($id);
        $this->beritaAcara($id);
    }

function beritaAcara($id)
{
    $data['peserta'] = $this->db->get_where('seminar', ['id' => $id])->row_array();
    //Berita Acara
    $html = $this->load->view('seminar/beritaAcara', $data, true);
    $this->load->library('M_pdf');

    $mpdf = $this->m_pdf->load([
        'mode' => 'utf-8',
        'format' => 'A4'
    ]);

    $mpdf->WriteHTML($html);
    $mpdf->Output('BERITA ACARA,' . ucfirst($data['peserta']['nama']) . ',' . $data['peserta']['npm'] . '.pdf', "I");
    unset($mpdf);
    unset($html);
}


function kehadiranDosen($id)
{
    $data['peserta'] = $this->db->get_where('seminar', ['id' => $id])->row_array();
    //Kehadiran Dosen
    $html2 = $this->load->view('seminar/kehadiranDosen', $data, true);
    $this->load->library('M_pdf');

    $mpdf2 = $this->m_pdf->load([
        'mode' => 'utf-8',
        'format' => 'A4'
    ]);

    $mpdf2->WriteHTML($html2);
    $mpdf2->Output('KEHADIRAN DOSEN,' . ucfirst($data['peserta']['nama']) . ',' . $data['peserta']['npm'] . '.pdf', "I");
    unset($mpdf2);
    unset($html2);
}

function nilaiSeminar($id)
{
    $data['peserta'] = $this->db->get_where('seminar', ['id' => $id])->row_array();
    //Nilai Seminar

    $html3 = $this->load->view('seminar/nilaiSeminar', $data, true);
    $this->load->library('M_pdf');

    $mpdf3 = $this->m_pdf->load([
        'mode' => 'utf-8',
        'format' => 'A4'
    ]);

    $mpdf3->WriteHTML($html3);
    $mpdf3->Output('NILAI SEMINAR,' . ucfirst($data['peserta']['nama']) . ',' . $data['peserta']['npm'] . '.pdf', "I");
    unset($mpdf3);
    unset($html3);
}

and when i click it, only kehadiran dosen generated, anyone can solve this? thank you so much before

  • Does this answer your question? [Unable to generate multiple PDFs using mPDF when I do not want to download files on server](https://stackoverflow.com/questions/37719545/unable-to-generate-multiple-pdfs-using-mpdf-when-i-do-not-want-to-download-files) – Finwe May 27 '21 at 14:36
  • thanks dude!, i found my answer.. instead of downloading multi file, i do separate pdf page file – Fahmi Sabila Dinnulhaq Jun 23 '21 at 11:47

0 Answers0