• 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

Clients authentication and user authentication with laravel

Laravel Model save() & update() Not Saving

Download & Save Zoom Recording in directory by PHP

Show rotation of tweets using current day of month

php echo xml documents with header

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

Modify microseconds of a PHP DateTime object

Laravel post contact form giving me error 419

find in set in laravel ? example

PHP array_filter with arguments

Changing font color in javascript

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

Failing validation doesn't stop code execution in livewire component

How to get the total hour from starting time to end time in php

mysql_result is defined but mysql_free_result warns it expected a resource

About Contact Privacy policy Terms and conditions