• 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

Attempted to call an undefined method named "get" of class "MailController"

how to validate form data in codeigniter 4

The "client_reference_id" argument is not passed

Combine array with same value and add other [duplicate]

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

Render the content of default_filter.php in Joomla front-end

PHP/HTML: Creating A SubMenu

How to give apache permission to write to home directory?

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

Laravel Collections. Is there some kind of assertStructure method?

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

Timber: Single post pagination does not work (wp_link_pages)

Boolean assignment operators in PHP

How to convert the int value to inch in PHP [closed]

str_word_count() function doesn't display Arabic language properly

About Contact Privacy policy Terms and conditions