php - DomPDF display data table except last page


I am working to produce pdf in codeigniter data. All code runs perfectly, it's just that I have a problem when doing a condition for the last page, the question is simple, I have data in table form and I want to display it for the entire page except for the last page.

if ( isset($pdf) ) { 
        if ($PAGE_NUM != $PAGE_COUNT) {
        $font = $fontMetrics->get_font("Arial, Helvetica, sans-serif", "normal");
        $size = 12;
        $pageText = "Page " . $PAGE_NUM . " of " . $PAGE_COUNT;
        $y = 15;
        $x = 520;
        $pdf->text($x, $y, $pageText, $font, $size);

i'm tying to change$pageText = "My string text" and this is working fine, but I got problem when I combine with html table. So in my case I change $pageText to$pageText = "<table><tr><td>My content here</td></tr></table>" but the results is<table><tr><td>My content here</td></tr></table> this should be a table, anyone can help me? why the results is still string? and wont generate to be a table?

fyi, the code that I attach is running perfectly to display a page, it's just that I want to modify it so that it displays a table.




the way you are loading in pdf is as a string and is not rendering html code. For rendering as html code you must put it inside loadHtml()

$pageText must be inside loadHtml().

You should keep the html codes inside loadHtml().
Or you can make a separate file using html for making pdf. you can check out documentation

People are also looking for solutions to the problem: php - call_user_func_array and __call create infinite loop


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.