• 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

Check if user online laravel

How can I get new CSRF token in LARAVEL by using ajax

PHP's array_map including keys

Unable to run composer install

How to add a custom field to all Woocommerce attribute terms using add_action

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

phpseclib 2.0 can not use Composer to create autoload

Fatal error: Array callback has to contain indices 0 and 1

Return multiple values from a function using mysqli_fetch_assoc [closed]

dompdf and img tag, image wont show

PHP web3 ERC20 token function call

is there any way to validate a field that sometime is File(image) && sometime is String(Src of same image)

How do I Post to .txt document before form submits

Parsing JSON File to array in PHP

using random function but it's displaying duplicates

About Contact Privacy policy Terms and conditions