• 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 send parameters in soap request in php in __soapcall() function

(Laravel) How to delete multiple models including optional relationships?

PHP error: "The zip extension and unzip command are both missing, skipping."

Merge key and value of array index [duplicate]

echo language construct is discouraged. (PHP)

Using Associative arrays

how to remove white space in select 2

Form repeater send wrong data with last element in Laravel

Laravel Collections. Is there some kind of assertStructure method?

google content api for shopping

find in set in laravel ? example

Display a product custom field only in WooCommerce Admin single orders

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

Substitute integers and dots with regex [duplicate]

How to update array value in Laravel

About Contact Privacy policy Terms and conditions