• 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

Reorder attribute dropdown terms in Woocommerce single variable products

How to submit a form when page loads using JavaScript?

Explode not working properly with dash

Select option from dropdown menu with PHP and mySql

Why rand() every time I refresh the page?

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

cakephp save drag and drop list order to database

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Modify microseconds of a PHP DateTime object

Jquery DataTables: Data not displaying in table via Ajax

I want a way to give path to my files which are outside of public folder in laravel

Unit (real unit test) of test laravel relationship

Show Custom Data in Woocommerce Order Details Admin Area

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

retrieve data from database using session

About Contact Privacy policy Terms and conditions