<?php
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;

// Retrieve HTML content
$html = file_get_contents('pdf.php');

// Initialize Dompdf object
$dompdf = new Dompdf();

// Load HTML content
$dompdf->loadHtml($html);

// Set paper size and orientation
$dompdf->setPaper('A4', 'portrait');

// Render PDF
$dompdf->render();

// Save PDF to server
$output = $dompdf->output();
file_put_contents('mypage.pdf', $output);
?>