• 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

Backend cannot be reached after Typo3 login screen

array_map triple dimensional array [duplicate]

How to get quarter for future date using Carbon?

How to create a individual template for page or post in custom plugin?

WooCommerce Additional Information - if empty, hide

Add New Parameter to Existing URL using htaccess

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

Override default Auth routes in Laravel 7

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Eloquent insert id with sequence next value

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

PHP array_filter with arguments

laravel sanctum Route [login] not defined

Phalcon: setStatusCode returns empty response

Can't call javascript alert alertify library from PHP

About Contact Privacy policy Terms and conditions