error: Some data has already been output, can’t send PDF file

error: Some data has already been output, can’t send PDF file
This is about the problem encountered in the process of generating PDF
That is, there has been an output before, but not the normal output
So you can add it before you start the PDF output process
ob_end_clean();

Read More: