• 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 get variable from JavaScript to PHP [duplicate]

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

(Cache::lock()) -> get() -- Under what conditions does it return false?

how to get value from array in laravel

Undefined Array Key error when uploading image on php

php code to send checkbox form results to email

I can't delete my image when it is liked because of the foreign key in mysql

Valet, Xdebug after reboot Big Sur not working

Android Volley getParams() method not getting called for JsonObjectRequest

Problems getting instance of UploadedFile in Yii2

I want to store data in new index as per my key in php [duplicate]

AJAX call fails with SyntaxError: Unexpected end of JSON input

Search for array row with specific column value and return another value from qualifying row

Laravel post contact form giving me error 419

Assets not referencing to public folder (Laravel)

About Contact Privacy policy Terms and conditions