@profemzy No, definitely not a view. If it is just as simple as in the example above then it's pretty much ok to do it right there in the controller. You can still move it somewhere else when your requirements change. I'd use a model to create the PDF if more complex logic needs to be applied or the logic is also applied somewhere else.
@skliche Thanks for taking time to answer my questions, one final question pls, i am trying to make the pdf pop up in the browser instead of having it save in a folder i tried this:
$pdf->stream();
@skliche $pdf->stream(); does not show pdf on my chrome browser. Chrome force to download it. whats the problem you think, is it? any problem I face if i use javascript function window.print() to print & create pdf ( chrome browser support to save file as pdf )
If these headers are present then Chrome should display the PDF instead of downloading it. Works fine in my Chrome browser as long as the PDF Viewer is enabled.
@skliche problem solved. The main problem was Internet Download Manger ( IDM ). Its interrupted request and force to download PDF file. After uninstall IDM everything find as you said. thanks bro