• 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

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

php curl_exec() Connection refused when retrieving a remote image

Transpose multidimensional array and join values with commas

How to install php yaml on CentOs?

How to delete old images from public folder on update using Laravel

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

Send Outlook 2010 email using PHP

Split array into 4-element chunks then implode into strings

PHPUnit (Phar) Fatal Error Only When Test Fails

Is it possible to change the table name in the migration file-laravel

Yii2 select2 database exception number of bound variables does not match number of tokens

PHP header location absolute URL

Update Order custom Field value with WooCommerce REST API

Array to string conversion

About Contact Privacy policy Terms and conditions