I’m doing this to find number of pages in a pdf. But for one pdf the pages are 20 but it’s showing 21. For rest it’s showing exact pages. I’ve checked document doesn’t seem any issue with document itself.
`function countt($url)
if ($url){
$pdf = file_get_contents($url);
if ($pdf === false) {
// Handle any errors when fetching the PDF
return -1;
}
// Debugging: Print PDF content
// echo $pdf;
if ($pdf){
$numberr = preg_match_all("//PageW/", $pdf, $dummy);
return $numberr;
}
}
}
New contributor
user55955 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.