• 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

PHP/HTML: Creating A SubMenu

How to validate Envato Purchase Code in PHP

Laravel Multi-language routes without prefix

Transform array, set each array element with parent key php

Display the WooCommerce product price inside a custom function

Filter WooCommerce related products by Polylang language

Why rand() every time I refresh the page?

How to create a individual template for page or post in custom plugin?

How to implement placeholder in a php file for moodle plugin?

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

How to display table header in every page using FPDF library?

WooCommerce Subscriptions: Remove role on cancelled subscription

Results page in other window

How to get page number on dompdf PDF when using "view"

Woocommerce redirect after add-to-cart error

About Contact Privacy policy Terms and conditions