• 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

WHM Enabling mod_rewrite

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

How do I set the maximum php memory limit

How to install php yaml on CentOs?

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

How to find the date a user created their Google account

PHPExcel_IOFactory::createWriter causes wrong behaviour

woocommerce change position of price

shell errors running php exec

Google API Heatmap Layer exception, why?

WooCommerce Subscriptions: Remove role on cancelled subscription

Warning: sqlite_query() expects parameter 1 to be resource, string given

Log a user out of a website when they put their computer to sleep

correct PHP headers for pdf file download

PHPExcel How to set conditional formatting to change cell background color based on cells values

About Contact Privacy policy Terms and conditions