• 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

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

MISSING UPDATES FOR: MEDIA Drupal 9

how to sort by a custom appended relation to model

Return multiple values from a function using mysqli_fetch_assoc [closed]

MOODLE: What does it mean to aggregate h5p assets?

How to disable only_full_group_by option in Laravel

Laravel php artisan serve to mimic HTTPS

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

echo language construct is discouraged. (PHP)

Adding hreflang tags automatically in WordPress subdirectory multisite

sort() not affecting original array while inside foreach loop

Adding one microsecond to Datetime object in PHP

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Modify microseconds of a PHP DateTime object

Get orders by date and status woocommerce

About Contact Privacy policy Terms and conditions