File "pdf_template.php"

Full Path: /home/ichhrkpd/public_html/idcm/application/views/pdf_template.php
File size: 2.56 KB
MIME-type: text/html
Charset: utf-8

<!DOCTYPE html>
<html>
<head>
    <style>
        body { font-family: Arial, sans-serif; }
        .header { text-align: center; font-size: 24px; font-weight: bold; margin-bottom: 20px; }
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { border: 1px solid black; padding: 10px; text-align: center; }
        th { background-color: #f2f2f2; }
        .page-break { page-break-before: always; } /* Forces a new page */
        .footer {
            position: fixed;
            bottom: -30px;
            left: 0;
            right: 0;
            text-align: center;
            font-size: 12px;
        }
        
        @page {
          @bottom-left {
            content: counter(page) ' of ' counter(pages);
          }
        }
        
    </style>
</head>
<body>
    <div class="header">Report</div>
  
<img src="https://hstu.ac.bd/img/prof-enamullah-vc-hstu.jpg" style="width:150px; height:auto;">


    <table>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Details</th>
        </tr>
        <?php 
        $counter = 0;
        $numbers = range(1, 52);
        foreach ($numbers as $num): 
            $counter++;
        ?>
        <tr>
            <td><?= $num ?></td>
            <td>bb</td>
            <td>bbcc</td>
        </tr>
        
        <!-- Insert a page break every 10 rows -->
        <?php if ($counter % 8 == 0): ?>
            </table>
            <div class="page-break"></div>
            <table>
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Details</th>
            </tr>
        <?php endif; ?>

        <?php endforeach; ?>
    </table>
    
    
    <div class="footer" style=''>
        <!-- This will be dynamically updated by page_script in the controller -->
    </div>

    <!-- Footer for page numbering -->
   <!-- <div class="footer">
        Page <span class="page-number"></span> of <span class="total-pages"></span>
    </div>
    --->
    <!-- DomPDF Page Script for Page Numbering -->
    <!---<script type="text/php">
        if (isset($pdf)) {
            $font = $fontMetrics->getFont('Arial', 'normal');
            $size = 10;
            $y = $pdf->get_height() - 30; // Adjust the Y position for the footer
            $x = $pdf->get_width() / 2 - 30; // Center the text horizontally

            // Add page numbers
            $pdf->page_text($x, $y, "Page {PAGE_NUM} of {PAGE_COUNT}", $font, $size);
        }
    </script>
    --->
</body>
</html>