• 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

Laravel Jetsream Profile page not loading on fresh install

How to add a custom field to all Woocommerce attribute terms using add_action

how to fix Service provider class not found when using repository?

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

How to find the date a user created their Google account

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

Hi, I am making a contact form thingy, and my php isn't working any reason why?

PHP Fatal error: Class not found - PHPUnit

How to render html from a @foreach loop in a textarea

CodeIgniter force_download is not working

php retrieve specific data onclick from database in a list format

PHP: set a (deep) array key from an array [closed]

Shopify password update using Shopify API

Laravel websockets AWS EC2 - Connection failed

How can i hide dt if dd got empty value

About Contact Privacy policy Terms and conditions