• 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

dompdf and img tag, image wont show

Sort a multidimensional array by integer inside of a string value which is two levels down

Not able to access model in the controller mautic

Having issue with matching rows in the database using PDO

html-php form submission after validation through JavaScript [closed]

how to validate form data in codeigniter 4

phpseclib 2.0 can not use Composer to create autoload

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

How to extract price from given url using Xpath?

image source not readable

How to reset Laravel AuthManager/guards in between API calls in tests?

PHP: remove filename from path

How to read laravel_session cookies saved in cookie memory of browser in client side?

how to check version of codeigniter framework?

How to get page number on dompdf PDF when using "view"

About Contact Privacy policy Terms and conditions