• 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 use PHPCBF to fix one issue at a time?

Install mysql client in docker image

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How to unlink image from folder?

Check if my GET request has Header: Token

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Limit of log line written to Apache Errorlog from mod php error_log

Laravel dosen't connect with Oracle

how to youtube api data to print in toolset metabox using a button click before save-post

PHP 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

"There is no active transaction" when refreshing database in Laravel 8.0 test

Autoloading classes in PHPUnit using Composer and autoload.php

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

insert multiple rows in a saveall in cakephp

Add New Parameter to Existing URL using htaccess

About Contact Privacy policy Terms and conditions