• 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 does codeigniter & Linux server throws unserialize() session data error when user tries to login

Undefined variable in Laravel 8 project (php 7.4)

How to add class name to an existing tag in php

PHP: set a (deep) array key from an array [closed]

PHP how to detect if running on arm64 cpu?

Substitute integers and dots with regex [duplicate]

nginx err_connection_refused, can anyone help me?

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

protect images from being copied

How to set a domain name with php artisan serve

How to convert the int value to inch in PHP [closed]

laravel automatically deletes server.php on php artisan serve

OAuth2 Token PHP

Detect emoticons in string

enroll_table three field fetch to payment form to create payment field in laravel 5.5

About Contact Privacy policy Terms and conditions