• 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

Comma separated list from array with "and" before last element

PHP: Insert marker every 3 iterations

How to run a shell as root from php (apache)

Check if user online laravel

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Is there an equivalent of DynamoDB on Azure as a PHP session Handler

Android Volley getParams() method not getting called for JsonObjectRequest

Symfony 4: "Autowire: you should configure its value explicitly."

How to add class name to an existing tag in php

OAuth2 Token PHP

how to prevent float variables displaying as scientific notation when printing [duplicate]

phpunit - mockbuilder - set mock object internal property

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

protect my blog content

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

About Contact Privacy policy Terms and conditions