• 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

GuzzleHttp Hangs When Using Localhost

PHP and WebView - Cookie doesn't are the same

yii2 and mssql insert varbinary into model

Get data from accuweather api url

Wordpress add responsive srcset header image to theme

php curl requesting twice

How update php.ini on a Mac OS X Mojave?

How to extract price from given url using Xpath?

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

retrieve data from database using session

Change the alert text on add to cart action without selected variation in Woocommerce

Form repeater send wrong data with last element in Laravel

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

MySQL upgrade causing unexpected results on simple WHERE clauses

Laravel dosen't connect with Oracle

About Contact Privacy policy Terms and conditions