• 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

Additional price based on cart item count in WooCommerce

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Spam Filter in Contact Form

Sort multidimensional array by column value within a column

php retrieve specific data onclick from database in a list format

php: command not found Command PhaseScriptExecution failed with a nonzero exit code

Twig - How to check if variable is a number / integer

api response laravel doesn't show

PHP web3 ERC20 token function call

if statement inside concatenation

array_map triple dimensional array [duplicate]

How can I get new CSRF token in LARAVEL by using ajax

Match single unknown parameter php (Morse-code Regex)

correct PHP headers for pdf file download

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

About Contact Privacy policy Terms and conditions