• 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

Create a new line whenever an array value reaches more than 10 characters

Insert And Retrieve Data in MySQL with $.post Noob Question

How to edit Records using CodeIgniter

find in set in laravel ? example

Not able to override collapsible.js in magento 2

How to send parameters in soap request in php in __soapcall() function

PHP | "The requested PHP extension bcmath is missing from your system."

Sum column values from multiple arrays

PHP rotate matrix counter-clockwise

PHP array slice from position + attempt to return fixed number of items

WooCommerce Additional Information - if empty, hide

array_key_exists(): The first argument should be either a string or an integer

PHP Slim Framework request using withAttribute error

How to add class name to an existing tag in php

Laravel Factory not calling callback 'afterCreating'

About Contact Privacy policy Terms and conditions