• 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

Fatal error: [] operator not supported for strings

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

What is PHP's equivalent of JavaScript's "array.every()"?

calling server using nusoap with complextype

Access relation of pivot table in Laravel

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

Call to a member function fetch_field() on a non-object MySQLiDB

CSS file not imported in laravel blade view

How to get the ID of the link in another page in php

ldap is missing from system when installing adldap2 in laravel

The sum of the user's points

advanced custom fields wordpress custom class

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

Warning: A non-numeric value encountered

Laravel after login Two factor not working

About Contact Privacy policy Terms and conditions