• 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

Add rows to Single product Additional information table in WooCommerce 3.6

find in set in laravel ? example

Not able to override collapsible.js in magento 2

Laravel Collections. Is there some kind of assertStructure method?

I want to display a sweetalert after the inserting of data in my database

Why isn't my PHP exception working?

Creating command to backup MySql database in Laravel

Error converting docx to pdf using Unoconv

oauth-private.key does not exist or is not readable

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

PHP if in_array() how to get the key as well?

Creating a config file in PHP

Printing more than one array using print_r or any other function in php

Laravel relationship belongsToMany with composite primary keys

How to change product Image when variables are selected in Shop and Archive Pages?

About Contact Privacy policy Terms and conditions