I'm trying to upload a pdf file. It can be password protected or not.
But I receive this error:
Allowed memory size of 134217728 bytes exhausted on line ***print_r($pages);***
This however only happens on PDF files that aren't password protected. Although, the Smalot PDF parser works fine with password protected PDF files.
I already have a helper method removePdfPassword()
for removing the password where necessary.
removePdfPassword($dir . $_FILES["bsfile"]["name"][$i], $_REQUEST['pdfpassword'][$i], $dir .$file_name);
include 'public/pdfparser/vendor/autoload.php';
$parser = new \Smalot\PdfParser\Parser();
$location = $dir . $file_name;
echo "<pre>";
$pdf = $parser->parseFile($location);
$pages = $pdf->getPages();
print_r($pages);
die;
Instead of printing the whole file's pages at once, try doing it in bits. I.e:
Instead of:
Use this: