Is there anyway I can reduce the size? because when I rearrange the 10 pages and combine the 10 pdf's again into a new file it will be 45mb, which is super unhandy.
Code: Select all
require_once "$docroot/fpdf/fpdf.php";
require_once "$docroot/fpdi/fpdi.php";
function split_sample_pdf()
{
$files = glob("./samplepdfs/*");
$pdf = new FPDI();
$pageCount = $pdf->setSourceFile($files[0]);
$pdf->close();
for ($x = 1; $x <= $pageCount; $x++)
{
$pdf = new FPDI();
$pdf->addPage();
$pdf->setSourceFile($files[0]);
$pdf->useTemplate($pdf->importPage($x));
$pdf->Output("./split_samples/pdf-". $x .".pdf", "F");
$pdf->close();
}
}