• 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

Sum column values from multiple arrays

Laravel - How to properly generate unique slugs from article titles?

WordPress - Dynamically add user ID to the end of a URL

Querying only one row from a one to many relationship laravel

how to use extended ASCII instead of unicode in PHP

Popup Window and PHP form

wp_remote_get() not passing authentication

How to identify whether webp image is static or animated?

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Ajax GET request fails in laravel 8

Create tags in laravel post publishing

Why i get wrong output for html markdown?

How to create a video stream from a single dynamic image in PHP

How to give apache permission to write to home directory?

How to get the total hour from starting time to end time in php

About Contact Privacy policy Terms and conditions