automica5 years ago Best Answer Level 54ReplyReport Spam@isamirsalehi you should be able to do something like this $path = 'pdf/GFG.pdf'; $totalPages = countPages($path); echo $totalPages; function countPages(string $path): int { $pdf = file_get_contents($path); return preg_match_all("/\/Page\W/", $pdf, $dummy); } Like Reply 1 like
YeZawHein5 years agoLevel 14ReplyReport Spam $pdftext = file_get_contents($request->file('request_name')); $num = preg_match_all("/\/Page\W/", $pdftext, $matches); dd($num); Like Reply 1 like