|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home/outerorb/emp.outerorbittech.in/scripts/ | |
|
Path: //home/outerorb/emp.outerorbittech.in/scripts/extract_pdf.php
Size: 1.19 KB
Permissions: 0666
<?php
$content = file_get_contents('C:/Users/hp/Downloads/amit kumar verma.pdf');
preg_match_all('/stream\r?\n(.*?)\r?\nendstream/s', $content, $matches);
foreach ($matches[1] as $i => $stream) {
$decoded = @gzuncompress($stream);
if ($decoded === false) $decoded = @gzinflate($stream);
if ($decoded === false) $decoded = @gzinflate(substr($stream, 2));
if ($decoded) {
// Extract text from PDF stream (BT...ET blocks)
preg_match_all('/BT(.*?)ET/s', $decoded, $blocks);
foreach ($blocks[1] as $block) {
preg_match_all('/\(([^\)\\\\]*(?:\\\\.[^\)\\\\]*)*)\)\s*Tj/', $block, $tj);
foreach ($tj[1] as $t) {
$t = stripcslashes($t);
if (strlen(trim($t)) > 1) echo $t;
}
// Also try TJ operator
preg_match_all('/\[(.*?)\]\s*TJ/s', $block, $tjArr);
foreach ($tjArr[1] as $tj2) {
preg_match_all('/\(([^\)]*)\)/', $tj2, $parts);
$line = '';
foreach ($parts[1] as $p) $line .= stripcslashes($p);
if (strlen(trim($line)) > 1) echo $line;
}
echo "\n";
}
}
}