• 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

How to make a foreign key not using primary key

No result using makeStyles Material UI in react 18

Toggle between a textbox and a select using PHP

CodeIgniter 3 is generating a session file on each request, why?

SilverStripe unable to populate multiple member Childs

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Symfony Error: "An exception has been thrown during the rendering of a template"

php file upload scanning using clamav, permissions on /tmp/

Laravel Get Days In Month From Month Number?

Edit XML in HTML form and submit to self

How do I pass the dynamic output of a php variable or php function to a CSS variable?

PHP Warning: Module already loaded in Unknown on line 0

Laravel - Browser displays message again when I press back button

passwordless LDAP login and get user information using Kerberos ticket in PHP

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

About Contact Privacy policy Terms and conditions