• 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

ldap is missing from system when installing adldap2 in laravel

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

how to see if database exists with PDO [duplicate]

how to remove %20 in the url in php

Laravel get user data with profile

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

LARAVEL: How to fetch id dynamically in a query builder?

Add a custom text for a particular product on specific email notification in Woocommerce

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

Adding reCAPTCHA v2 into my PHP file

Symfony there are no commands defined in the "make" namespace

Laravel print last executed SQL query with Query log

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Laravel relationship belongsToMany with composite primary keys

About Contact Privacy policy Terms and conditions