<?php ob_start();
error_reporting(0);
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");
session_start();
if (!isset($_SESSION['id_user'])) {
    die('Anda tidak diijinkan mengakses langsung');
}
$bl=date('m');
    $bulane = fetch ($koneksi, 'bulan', ['bln' =>$bl]);
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>

    <title>Data Buku</title>
<link rel="stylesheet" href="../../plugins/bootstrap/dist/css/bootstrap.min.css">
</head>
<style>
@page { margin: 20px; }
body { margin: 20px; }
</style>
<body style="font-size: 11px;">
    
   
    <center>
        <h6>QR CODE BUKU PERPUSTAKAAN<br><?= $setting['sekolah'] ?></h6>
    </center>
    <br>
    <table>
	<tr>
		<?php
		$no = 0;
		$query = mysqli_query($koneksi, "select * from buku");
        while ($tjn = mysqli_fetch_array($query)) {
		
                   $no++;
                   ?>
				     
		<td style="width:100px;text-align:center">
		<img src="../../temp/buku/<?= $tjn['judul']?>.png" >
		<br>
		<?= $tjn['judul']?></span>
		</td>
		
		<?php } ?>	
</tr>		
   </table>
</body>

</html>
<?php

$html = ob_get_clean();
require_once '../../vendors/autoload.php';

use Dompdf\Dompdf;

$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream("Data Buku" . $bulane['ket'] . ".pdf", array("Attachment" => false));
exit(0);
?>