• 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

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

Unable to uninstall brew php from homebrew

Best way to scrolldown onpageload

How to change product Image when variables are selected in Shop and Archive Pages?

How to install LDAP in Docker php-fpm alpine

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

PHP Warning: Module already loaded in Unknown on line 0

Combine array with same value and add other [duplicate]

Laravel unique validation on multiple columns

Unable to run composer install

How to submit the custom form data in database in WordPress without plugin using ajax?

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

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

Laravel set default language not working

how to insert data into select2 search input after scan using qrcode

About Contact Privacy policy Terms and conditions