• 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

Update Order custom Field value with WooCommerce REST API

Toggle between a textbox and a select using PHP

PHP date() with timezone?

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

Which is faster php date functions or carbon?

how to use extended ASCII instead of unicode in PHP

how to get the header value, if we don't know the value because the value is random from the server

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

Adding custom body class to the custom archive pages

How do I set the maximum php memory limit

How to put php code inside opening and closing shortcodes

Get keys from associative array [duplicate]

Laravel: Why is my variable not being set while it's in the construct function of the controller?

How to get unique slug to same post-title for other time too?

About Contact Privacy policy Terms and conditions