• 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

Show rotation of tweets using current day of month

How do I truncate a decimal in PHP?

Composer fails with kylekatarnls/update-helper on new homestead

Component install error: JInstaller: :Install: File does not exist

Remove country code from phone number?

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

printing all running session variable in laravel 5.1

How to trim a video by 4 fragments to 4 seconds using the PHP-FFMpeg?

Laravel: Create morphs() relationship nullable

Sort multidimensional array by column value within a column

Group data in a multidimensional array based on two columns

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

Select option menu read from database and use it's values

generate an Excel file using PHP

Limit login attempts in Laravel 5.7

About Contact Privacy policy Terms and conditions