• 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

PHPSpreadsheet - How Do I Use Auto Migration Tool

Inserting Country Selection into MySQL PHP [duplicate]

Upgrade PHP on AWS Linux

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

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

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

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

PHP using str_starts_with for array to exclude same as with wildcard

How do I call a php file with axios?

"cannot list resources" error from WooCommerce REST API

Handle error for duplicate entries - PHP/MySQL

carbon generated datetime not stored correctly into the database

How to map the two arrays with a duplicate value?

PHP Array split string and Integers

mysql slow on updates for a well optimized query

About Contact Privacy policy Terms and conditions