• 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

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

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Show only featured products in Woocommerce shop page

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Show Custom Data in Woocommerce Order Details Admin Area

Getting output of MS stored procedure on php call

HTML and PHP in one file

How to send parameters in soap request in php in __soapcall() function

Facebook API, get page post link (PHP)

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

ldap is missing from system when installing adldap2 in laravel

Get number of working days between two dates in PHP [duplicate]

PHPSpreadsheet - How Do I Use Auto Migration Tool

Laravel: Create morphs() relationship nullable

Changing font color in javascript

About Contact Privacy policy Terms and conditions