<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

// WAJIB: Naikin limit
ini_set('memory_limit', '256M');
set_time_limit(60);

require_once 'vendor/autoload.php';

use Dompdf\Dompdf;
use Dompdf\Options;

$options = new Options();
$options->set('tempDir', sys_get_temp_dir()); // INI KUNCINYA BUAT INFINITYFREE
$options->set('isRemoteEnabled', true);

$dompdf = new Dompdf($options);

$html = '<h1>TES PDF BERHASIL</h1><p>Kalau ini muncul, Dompdf udah jalan.</p>';

$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream("tes.pdf", ["Attachment" => false]);
?>