• 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

PHP array, move keys and values to new array, but mix it up

How to run a shell as root from php (apache)

Detect emoticons in string

codeigniter 4 running error first time with xampp

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

Why isn't my PHP exception working?

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

Laravel Displaying image from database

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

Backend cannot be reached after Typo3 login screen

How to extract price from given url using Xpath?

Laravel Sanctum CSRF not authenticating

I want to display a sweetalert after the inserting of data in my database

stay with the last 15 elements of an array [duplicate]

About Contact Privacy policy Terms and conditions