php - Generate a pdf file using dompdf and CodeIgniter -
i have problem generation pdf using codeigniter , dompdf, code is:
public function generatetitlepage($name = '', $surname='', $number='', $village='') { $this->load->library('dompdf_gen'); $dompdf = new dompdf(); $html = <<<html <html> <body> <h1>hello:$name</h1><br /> <h1>hello:$surname</h1><br /> <h1>hello:$number</h1><br /> <h1>hello:$village</h1> </body> </html> html; $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("welcome.pdf"); }
the resultat function
hello: name surname number village hello: hello: hello:
but need separate this:
hello:name hello:surname hello:number hello:village
help me please. function called:
<a href="<?=base_url()."dosar/generatetitlepage($d[name]$d[surname]$d[number]$d[village])" ?>" class="btn btn-primary btn-sm marg-top-10">generate</a>
the way generating url not correct need understand routing first
like
example.com/class/function/id/
- example.com domain
- class controller name
- function function name reside in above mentioned controller
- id 1st parameter above mentioned function , same can pass many parameters like
example.com/class/function/parameter1/parameter2/parameter3/
for pdf url can write anchor below
<a href="<?=base_url().'dosar/generatetitlepage/'. $d[name] .'/'. $d[surname] .'/'. $d[number] .'/'. $d[village])' ?>" class="btn btn-primary btn-sm marg-top-10">generate</a>
Comments
Post a Comment