• 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

Sum column values from multiple arrays

How can I make good efficent AJAX live forms with just jQuery and

JQuery content editable div and text box on submit not sending POST

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

How to install ZeroMQ for PHP on an Alpine Linux container?

301 Redirect to remove query string on homepage only

best way to store error messages in Laravel (session or variable)

possible options to create pdf file using html elements to generate invoice in php and codeigniter

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Jquery DataTables: Data not displaying in table via Ajax

PHP array stringify

WooCommerce Subscriptions: Remove role on cancelled subscription

No result using makeStyles Material UI in react 18

PHP: How to raise number to (tiny) fractional exponent?

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

About Contact Privacy policy Terms and conditions