note 90253 added to ref.pdf
| From: | bolyde at gmail dot com | Date: | Sun, 12 Apr 2009 19:27:44 +0000 |
| Subject: | note 90253 added to ref.pdf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153122@lists.php.net to get a copy of this message | ||
Hi,
To find the page number of a PDF File, i find this :
<?php
public function getNumPagesInPDF(array $arguments = array())
{
@list($PDFPath) = $arguments;
$stream = @fopen($PDFPath, "r");
$PDFContent = @fread ($stream, filesize($PDFPath));
if(!$stream || !$PDFContent)
return false;
$firstValue = 0;
$secondValue = 0;
if(preg_match("/\/N\s+([0-9]+)/", $PDFContent, $matches)) {
$firstValue = $matches[1];
}
if(preg_match_all("/\/Count\s+([0-9]+)/s", $PDFContent, $matches))
{
$secondValue = max($matches[1]);
}
return (($secondValue != 0) ? $secondValue : max($firstValue, $secondValue));
}
?>
----
Server IP: 195.207.10.20
Probable Submitter: 83.77.27.237
----
Manual Page -- http://www.php.net/manual/en/ref.pdf.php
Edit -- https://master.php.net/note/edit/90253
Del: integrated -- https://master.php.net/note/delete/90253/integrated
Del: useless -- https://master.php.net/note/delete/90253/useless
Del: bad code -- https://master.php.net/note/delete/90253/bad+code
Del: spam -- https://master.php.net/note/delete/90253/spam
Del: non-english -- https://master.php.net/note/delete/90253/non-english
Del: in docs -- https://master.php.net/note/delete/90253/in+docs
Del: other reasons-- https://master.php.net/note/delete/90253
Reject -- https://master.php.net/note/reject/90253
Search -- https://master.php.net/manage/user-notes.php