• 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

PHP Download MP3 files from directory on server

Can I use a WooCommerce function without any WooCommerce page?

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

mysql_result is defined but mysql_free_result warns it expected a resource

merge all files in directory to one text file

Can I write PHP code across multiple lines per statement?

How to convert a carbon into string, to take the date only?

TesseractOCR not working for Laravel

OAuth2 Token PHP

Split comma separated value from table column into rows using mysql?

Add rows to Single product Additional information table in WooCommerce 3.6

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

str_word_count() function doesn't display Arabic language properly

PhP how to calculate moments with variables rows

About Contact Privacy policy Terms and conditions