• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to get total pages of PDF with FPDF?

phpfpdf


PHP Snippet 1:

$pdf = new FPDF();
$pdf->AddPage();
$pdf->AddPage();
$nb = $pdf->PageNo();
$pdf->Output();

PHP Snippet 2:

    // Get the file into path 
    $path = 'LargePDF.pdf';
    // Call a the function FunctionCountPages 
    $totalPageCount=  FunctionCountPages($path);;
    echo $totalPages;
    function FunctionCountPages($path) 
          {
              $pdftextfile = file_get_contents($path);
              $pagenumber = preg_match_all("/\/Page\W/", $pdftextfile, $dummy);
              return $pagenumber;
            }
//I hope this work for you

Related Snippets

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Laravel Passport - Not able to get token string in response?

Unable to get password for the instance created from AMI

javascript html popup window

Laravel PackageManifest.php: Undefined index: name

Make Shipping Method fields Mandatory on Woocommerce checkout page

php mysql + create a friend request system

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

How to create a individual template for page or post in custom plugin?

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

How to fix this error : Ask your hosting provider to use PHP 7.2.5 or higher for both HTTP and CLI?

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

generating a random code in php?

Access relation of pivot table in Laravel

Laravel unique validation on multiple columns

About Contact Privacy policy Terms and conditions