• 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

Use same method for inertia response and json response Laravel Jetstream

Insert multidimensional array to codeigniter cart

Execute only one time and then wait set period of time before executing again

Change the alert text on add to cart action without selected variation in Woocommerce

How to show a popup modal in codeIgniter?

How can I create a Download Page with post php method?

PHP: How to raise number to (tiny) fractional exponent?

Laravel SQL query midnight time not showing

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

How to write PHP in XSLT

Combining a describing and one array with data

Laravel eloquent update record without loading from database

Python - Include another Python script

Elastic Beanstalk with Laravel Envoy

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

About Contact Privacy policy Terms and conditions