• 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

Explode not working properly with dash

MySQL default time format UTC or GMT?

php curl requesting twice

Select option from dropdown menu with PHP and mySql

How to prevent phpmailer sending embedded image as an attachment on Gmail?

Unable to guess the mime type as no guessers are available Laravel 5.2

Symfony 4: "Autowire: you should configure its value explicitly."

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

Creating command to backup MySql database in Laravel

Assign output of PHP function to a variable

Printing more than one array using print_r or any other function in php

WooCommerce Subscriptions: Remove role on cancelled subscription

How to get multiple values with same key from an array PHP

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

About Contact Privacy policy Terms and conditions