• 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

Only on Firefox "Loading failed for the <script> with source"

Laravel Get Days In Month From Month Number?

Unit (real unit test) of test laravel relationship

Add New Parameter to Existing URL using htaccess

Sort a multidimensional array by integer inside of a string value which is two levels down

Check if string contains a value in array [duplicate]

Appending data to an anchor tag

Symfony autowiring issues since docker update

how to see if database exists with PDO [duplicate]

disable two buttons after clicking another button

Statement that checks whether a URL contains a particular path?

add_action() function in wordpress not working [duplicate]

PHPExcel file download using AJAX call

PHP if in_array() how to get the key as well?

Mobile browsers are adding .html to filename on download

About Contact Privacy policy Terms and conditions