• 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 disable only_full_group_by option in Laravel

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

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

Laravel eloquent update record without loading from database

selected value from the listbox in php

Inserting data into SQL Server Db An Invalid direction was specified

Laravel UUID generation

How to find phpcs current default standard

PHP returning an error message and false

Normalize DateInterval in PHP

phpseclib 2.0 can not use Composer to create autoload

add uri parameter to Route name in laravel

Unable to Edit config.inc.php

How to insert Google Adsense Code in PHP script?

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

About Contact Privacy policy Terms and conditions