• 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

jQuery Ajax Post with data

How to send upload image through email

Combining a describing and one array with data

Is it possible to change the table name in the migration file-laravel

How to average columns of data from multiple, flat arrays?

PHP my timezone is no setting up in PHP.ini File in xampp

Woocommerce product attributes with hierarchy like categories

How can I stop a symfony process which is listening on http://127.0.0.1:8000

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

how can I set a session variable in Drupal 8 and get it in a php script?

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

Google Gmail API - How to login programatically?

Add custom text under order details on WooCommerce My account view order pages

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

Limit of log line written to Apache Errorlog from mod php error_log

About Contact Privacy policy Terms and conditions