• 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

Symfony Error: "An exception has been thrown during the rendering of a template"

laravel 5.6 bulk inserting json data

PHP drop down list using array's and foreach (else and for) code

Sagepay Error The Vendor failed to provide a RedirectionURL

Get all WooCommerce products within own plugin

Unable to run composer install

Laravel get user data with profile

Error converting docx to pdf using Unoconv

How to insert Google Adsense Code in PHP script?

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

How can I create a Download Page with post php method?

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

PHP Array split string and Integers

backup files to google drive using PHP

How to break out of a foreach once a condition is met?

About Contact Privacy policy Terms and conditions