I have pdf files. Need import them to system and split by pages. Seperate page = separate file.
I tried use FPDF and FPDI:
$pdf = new FPDI(); //FPDI extends TCPDF
$pdf->AddPage();
$pages = $pdf->setSourceFile($sLeadDirPath . $sImageName);
//for first page...
$page = $pdf->ImportPage(1);
$pdf->useTemplate($page, 0, 0);
$pdf->Output('newTest.pdf', 'F');
Some files work good, but for some files i got error:
Fatal error: Uncaught exception 'setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException' with message 'This PDF document is encrypted and cannot be processed with FPDI.'
As I understood file is encrypted (but i can open this without any problems). How can I solve this?
Or maybe there are other ways for split pdf in PHP without FPDI?
Thanks!