Bear with me, I am trying to use the library: dompdf to produce a PDF file from my web app developed with codeigniter-4.4. A PDF that should include a png image, But it seems that I am getting something wrong somewhere.
I get the dompdf into the ci4 through composer and I was able to generate a PDF file containing desired content but excluding the png image.
So I checked around and came across many suggested solutions which are as follows:
SetChrootandSetBasePathto tell dompdf where to get your image- Use absolutely path in your src not relative path.
- Set
isRometeEnabledto true - Use
$_SERVER_ROOTplus the remaining trilling path to your image. And Soo on
I have tested all as par my little knowledge with php and ci4. But what I understood so far was that I am not getting the instructions done as directed in the above solutions because in each, I see one or two user saying this work for me.
come to my aid on what should I put inside
1. $this->getOption->setChroot()
2. $this->getOption->setBasePath()
3. and in the view file, the IMG tag scr should be what please.
My controller code currently:
$dompdf->getOptions->setChroot(ROOTPATH)
$dompdf->getOptions->setBasePath(base_url())
$dompdf->loadHtml(view('pdfview'))
$dompdf->setPaper('A4')
$dompdf->render()
$dompdf->stream('pdfname')
Image in the View file:
<IMG src="/hotuna/logo.png">
hotuna is a folder inside public folder of the normal codeigniter folder structure.
Thanks for your anticipated consideration.