• 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

How can I make good efficent AJAX live forms with just jQuery and

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

PHP, how to convert Int value to Week days

How in Laravel run JavaScript code stored in php variable?

Laravel relationship belongsToMany with composite primary keys

PHP Array split string and Integers

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

SlimExceptionHttpNotFoundException

Laravel Nova, route not found

Laravel Sanctum CSRF not authenticating

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

Laravel PHP: multiple project run at the same time [closed]

Display a success custom notice after Placing an Order in WooCommerce

How to upload mpdf file after generating to s3 bucket in php

PHP Slim Framework request using withAttribute error

About Contact Privacy policy Terms and conditions