• 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

Saving Data from form to database using AngularJS and php

What is the function of the (new Date()).getTime() in PHP?

Image upload not working through ajax Laravel

using random function but it's displaying duplicates

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

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

Laravel: Create morphs() relationship nullable

Twig - How to check if variable is a number / integer

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

GA4 custom event from server side, can someone tell me how i can do the following code in php?

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Symfony redirect if already loggedin from login page

Laravel Nova, route not found

Fetch files from next cloud storage and display in Laravel website

About Contact Privacy policy Terms and conditions