setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pageCount = $pdf->setSourceFile($file);
for ($pageNo = 1; $pageNo <= min($pageCount, 1000); $pageNo++) {
$pdf->AddPage();
$pageId = $pdf->importPage($pageNo, Fpdi\PdfReader\PageBoundaries::MEDIA_BOX);
$pdf->useTemplate($pageId, 20, 20, 100, 100);
$pdf->Rect(20, 20, 100, 100);
#var_dump($pageId);
$pageId = $pdf->importPage($pageNo, Fpdi\PdfReader\PageBoundaries::ART_BOX);
$s = $pdf->useTemplate($pageId, 120, 120, 100);
$pdf->Rect(120, 120, $s['width'], $s['height']);
// $s = $pdf->useTemplate($pageId, 220, 120, 100, 100);
// $pdf->Rect(220, 120, $s['width'], $s['height']);
#var_dump($pageId);
#break;
}
$pdf->Output(realpath('memory.pdf'), 'F');
echo microtime(true) - $start;
echo "
";
var_dump(memory_get_usage());
unset($pdf, $files, $pageNo, $file, $pageCount, $pageId, $s);
var_dump(gc_collect_cycles());
echo "
";
var_dump(memory_get_usage());
echo "
";
echo filesize('memory.pdf');
echo "
";
echo "
";
}
?>