• 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

Adding hreflang tags automatically in WordPress subdirectory multisite

How to set dynamic `home` and `siteurl` in WordPress?

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

Not able to access model in the controller mautic

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

How to use PHPCBF to fix one issue at a time?

Laravel websockets AWS EC2 - Connection failed

Make certain characters of a word from string bold

Cache clear probem in Larave

Wordpress wpdb->delete issue

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer

How to break out of a foreach once a condition is met?

Laravel Pagination links() not working

No definition found for function in vendor vscode

PHP - CURL using HTTPS [closed]

About Contact Privacy policy Terms and conditions