• 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

SlimExceptionHttpNotFoundException

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

Insert database rows from columns of data from associative array of indexed arrays

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Appending data to an anchor tag

Magento 2 - Controller returning blank page

Elastic Beanstalk with Laravel Envoy

GRPC installed successfully on ubuntu but php is looking for it in another folder

PHPSpreadsheet - How Do I Use Auto Migration Tool

how to retrieve the first and last instance of a row in pdo dataset

Dynamic table in HTML using MySQL and php

Having trouble with PDO queries (Notice: Undefined index)

Laravel websockets AWS EC2 - Connection failed

About Contact Privacy policy Terms and conditions