• 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 add a custom field to all Woocommerce attribute terms using add_action

Convert date and time to Jalali in Laravel

How to remove from a multidimensional array all duplicate elements including the original?

php mysql + create a friend request system

PHP Form Not Inserting

Merge key and value of array index [duplicate]

Laravel Get Days In Month From Month Number?

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

PHP SoapClient: set a namespace without prefix

How to create a scheduler application in php

How to create a video stream from a single dynamic image in PHP

How to render html from a @foreach loop in a textarea

PHPExcel How to set conditional formatting to change cell background color based on cells values

Laravel no logout option from menu after successfull login

Check if user online laravel

About Contact Privacy policy Terms and conditions