5d4 < set_time_limit(1200); 7,87d5 < $infile='"input_pdf.pdf"'; < < if (isset($_GET['install'])) { < if ($_GET['install'] == 'pdfimages') { < if (PHP_OS == "Darwin") { < putenv('PATH=/usr/local/bin'); < $x="

Regarding ...

brew install popper

If errors below, you should try command above, yourself, on command line ...


"; < $x.=shell_exec('brew install poppler 2> huh.jnk'); < if (file_exists('huhjunk.jnk')) { < $x.=file_get_contents('huhjnk.jnk'); < unlink('huh.jnk'); < } < echo "

" . $x . "
"; < } else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { < $x="

Regarding ...

sudo apt-get update
sudo apt-get install poppler-utils

If errors below, you should try commands above, yourself, on command line ...


"; < $x.=shell_exec('sudo apt-get update'); < $x.=shell_exec('sudo apt-get install poppler-utils'); < echo "

" . $x . "
"; < } < } < exit; < } < < $filepath=''; < $rest=""; < $restfrom=""; < $restto="









<

... or ...

<
<

<
<

<

<

< <
< <
< < < < "; < < function rsearch($folder, $pattern, $size) { // thanks, anyway, to https://stackoverflow.com/questions/17160696/php-glob-scan-in-subfolders-for-a-file < $didea=''; < if (PHP_OS == "Darwin") { < //file_put_contents("x.ksh", "find " . $folder . " -type f -name \"" . $pattern . "\" 2> /dev/null -exec wc -c {} + | egrep '^ " . $size . " ' | sed '/ " . $size . " /s///g'"); < if ($folder == DIRECTORY_SEPARATOR) { < $didea=shell_exec("find \$HOME/Downloads -type f -name \"" . $pattern . "\" 2> /dev/null -exec wc -c {} + | egrep '^ " . $size . " ' | sed '/ " . $size . " /s///g'"); < //file_put_contents("xx.ksh", $didea); < if ($didea != '') { return $didea; } < $didea=shell_exec("find " . dirname(__FILE__) . DIRECTORY_SEPARATOR . " -type f -name \"" . $pattern . "\" 2> /dev/null -exec wc -c {} + | egrep '^ " . $size . " ' | sed '/ " . $size . " /s///g'"); < //file_put_contents("xxx.ksh", $didea); < if ($didea != '') { return $didea; } < } < return shell_exec("find " . $folder . " -type f -name \"" . $pattern . "\" 2> /dev/null -exec wc -c {} + | egrep '^ " . $size . " ' | sed '/ " . $size . " /s///g'"); < } < //$iti = new RecursiveDirectoryIterator($folder); < //foreach (new RecursiveIteratorIterator($iti) as $file) { < //foreach (glob($folder . $pattern) as $file) { < // if (strpos($file , $pattern) !== false && filesize($file) == $size) { < // return $file; < // } < //} < return ''; < } 89,118c7 < if (isset($_GET['filename']) && isset($_GET['filesize']) && !isset($_GET['filepath'])) { < if (file_exists(str_replace('+',' ',urldecode($_GET['filename'])))) { < if (filesize(str_replace('+',' ',urldecode($_GET['filename']))) == $_GET['filesize']) { < $filepath=dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['filename'])); < } < } < if ($filepath == '') { < $filepath = rsearch(DIRECTORY_SEPARATOR, str_replace('+',' ',urldecode($_GET['filename'])), $_GET['filesize']); < } < echo ""; < exit; < } else if (isset($_GET['filename']) && isset($_GET['filesize']) && $_GET['filepath'] == '') { < if (file_exists(str_replace('+',' ',urldecode($_GET['filename'])))) { < if (filesize(str_replace('+',' ',urldecode($_GET['filename']))) == $_GET['filesize']) { < $filepath=dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['filename'])); < } < } < if ($filepath == '') { < $filepath = rsearch(DIRECTORY_SEPARATOR, str_replace('+',' ',urldecode($_GET['filename'])), $_GET['filesize']); < } < echo ""; < exit; < } else if (isset($_GET['filename']) && isset($_GET['filesize']) && isset($_GET['filepath'])) { < $anyextrac=''; < if (substr(str_replace('+',' ',urldecode($_GET['filepath'])), -1, 1) != DIRECTORY_SEPARATOR) { < $anyextrac=DIRECTORY_SEPARATOR; < } < echo ""; < exit; < } --- > $infile='"input_pdf.pdf"'; 121,231c10,12 < < < < var dmode='ltor'; < var lastpath='', lastfilename=''; < < function woit(ioo) { < var wo=null; < if (ioo.src.indexOf('data:') == 0) { < wo=window.open('', '_blank'); < wo.document.write(''); < wo.document.title=ioo.title; < } else { < window.open(ioo.src, '_blank'); < } < } < < function checkf() { < if (document.getElementById('justputpdffilename').innerHTML != '') { < document.getElementById('justputpdffilename').title=document.getElementById('justputpdffilename').innerHTML; < document.getElementById('justputpdffilename').innerHTML=''; < if (document.getElementById('thewords').value.trim() == '' || document.getElementById('thewords').value == lastfilename) { < document.getElementById('thewords').value=document.getElementById('justputpdffilename').title; < lastfilename=document.getElementById('justputpdffilename').title; < } < if (document.getElementById('justputpdfpath').innerHTML == '' && document.getElementById('justputpdfpath').title == '') { < if (document.getElementById('justputpdffilesize').innerHTML != '') { < //alert('am going away to look for filename=' + lastfilename + ' of size ' + document.getElementById('justputpdffilesize').innerHTML); < document.getElementById('justputpdfpath').title=' '; < //var xx=prompt(document.URL.split('?')[0].split('#')[0] + '?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename), document.URL.split('?')[0].split('#')[0] + '?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename)); < document.getElementById('path').style.cursor='progress'; < document.getElementById('gifif').src='./php_calls_pdfimages.php?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename); < } < } < } < if (document.getElementById('justputpdfpath').innerHTML != '') { < document.getElementById('justputpdfpath').title=document.getElementById('justputpdfpath').innerHTML; < document.getElementById('justputpdfpath').innerHTML=''; < if (document.getElementById('justputpdfpath').title.indexOf('/') != -1) { < if (document.getElementById('justputpdfpath').title.slice(-1) != '/') { < document.getElementById('justputpdfpath').title+='/'; < } < } else { < if (document.getElementById('justputpdfpath').title.slice(-1) != String.fromCharCode(92)) { < document.getElementById('justputpdfpath').title+=String.fromCharCode(92); < } < } < if (document.getElementById('path').value.trim() == '' || document.getElementById('path').value == lastpath) { < document.getElementById('path').value=document.getElementById('justputpdfpath').title; < lastpath=document.getElementById('justputpdfpath').title; < } < } < if (document.getElementById('path').value != '') { < document.getElementById('path').style.cursor='pointer'; < } < } < < < function iifopen(iois) { < if (iois != null) { < var aconto = (iois.contentWindow || iois.contentDocument); < if (aconto.document) { aconto = aconto.document; } < if (aconto != null) { < //alert(1); < if (aconto.getElementById('distyle')) { < aconto.getElementById('distyle').innerHTML+=''; < aconto.getElementById('files').accept='.pdf'; < aconto.getElementById('files').multiple=false; < aconto.getElementById('files').style.border='5px solid yellow'; < arect=aconto.getElementById('files').getBoundingClientRect(); < //alert(2); < //aconto.getElementById('files').click(); < } < } < } < } < < < function toggle() { < if (dmode == 'ltor') { < dmode='ttob'; < document.getElementById('smode').innerHTML='⬇'; < document.getElementById('mydflex').style.display='none'; < document.getElementById('mytable').style.display='none'; < document.getElementById('mytabletwo').style.display='table'; < } else if (dmode == 'ttob') { < dmode='fill'; < document.getElementById('smode').innerHTML='➡'; < document.getElementById('mydflex').style.display='none'; < document.getElementById('mytabletwo').style.display='none'; < document.getElementById('mytable').style.display='table'; < } else { < dmode='ltor'; < document.getElementById('smode').innerHTML='↘'; < document.getElementById('mytable').style.display='none'; < document.getElementById('mytabletwo').style.display='none'; < document.getElementById('mydflex').style.display='block'; < } < } < < setInterval(checkf, 1000); < < < <

Extract the Images Within a PDF File via Pdfimages

<

RJM Programming April, 2023

--- > >

Extract the Images Within a PDF File via Pdfimages

>

RJM Programming - April, 2023

233d13 <
235,243c15 <
< < <

<
< < 292,294c58 < " . str_replace(explode('>', explode('', explode("', '', explode('', explode(" --- > 296,299d59 < < < echo str_replace($rest, $restto, $proposedtable); < 303,444c63,65 < < < < var lastpath='', lastfilename=''; < < function checkf() { < if (document.getElementById('justputpdffilename').innerHTML != '') { < document.getElementById('justputpdffilename').title=document.getElementById('justputpdffilename').innerHTML; < document.getElementById('justputpdffilename').innerHTML=''; < if (document.getElementById('thewords').value.trim() == '' || document.getElementById('thewords').value == lastfilename) { < document.getElementById('thewords').value=document.getElementById('justputpdffilename').title; < lastfilename=document.getElementById('justputpdffilename').title; < } < if (document.getElementById('justputpdfpath').innerHTML == '' && document.getElementById('justputpdfpath').title == '') { < if (document.getElementById('justputpdffilesize').innerHTML != '') { < //alert('am going away to look for filename=' + lastfilename + ' of size ' + document.getElementById('justputpdffilesize').innerHTML); < document.getElementById('justputpdfpath').title=' '; < //var xx=prompt(document.URL.split('?')[0].split('#')[0] + '?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename), document.URL.split('?')[0].split('#')[0] + '?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename)); < document.getElementById('path').style.cursor='progress'; < document.getElementById('gifif').src='./php_calls_pdfimages.php?filepath=&filesize=' + document.getElementById('justputpdffilesize').innerHTML + '&filename=' + encodeURIComponent(lastfilename); < } < } < } < if (document.getElementById('justputpdfpath').innerHTML != '') { < document.getElementById('justputpdfpath').title=document.getElementById('justputpdfpath').innerHTML; < document.getElementById('justputpdfpath').innerHTML=''; < if (document.getElementById('justputpdfpath').title.indexOf('/') != -1) { < if (document.getElementById('justputpdfpath').title.slice(-1) != '/') { < document.getElementById('justputpdfpath').title+='/'; < } < } else { < if (document.getElementById('justputpdfpath').title.slice(-1) != String.fromCharCode(92)) { < document.getElementById('justputpdfpath').title+=String.fromCharCode(92); < } < } < if (document.getElementById('path').value.trim() == '' || document.getElementById('path').value == lastpath) { < document.getElementById('path').value=document.getElementById('justputpdfpath').title; < lastpath=document.getElementById('justputpdfpath').title; < } < } < if (document.getElementById('path').value != '') { < document.getElementById('path').style.cursor='pointer'; < } < } < < < function iifopen(iois) { < if (iois != null) { < var aconto = (iois.contentWindow || iois.contentDocument); < if (aconto.document) { aconto = aconto.document; } < if (aconto != null) { < //alert(1); < if (aconto.getElementById('distyle')) { < aconto.getElementById('distyle').innerHTML+=''; < aconto.getElementById('files').accept='.pdf'; < aconto.getElementById('files').multiple=false; < aconto.getElementById('files').style.border='5px solid yellow'; < arect=aconto.getElementById('files').getBoundingClientRect(); < //alert(2); < //aconto.getElementById('files').click(); < } < } < } < } < < setInterval(checkf, 1000); < < < <
<

... or ...

<
--- > >

Extract the Images Within a PDF File via Pdfimages

>

RJM Programming - April, 2023

446,447d66 <

Extract the Images Within a PDF File via Pdfimages

<

RJM Programming - April, 2023

450,452c69,71 <

<

< --- >

>

> 454,463c73 < < <
< < < < --- > 469,472c79,80 < $huhw=shell_exec("where pdfimages"); < if (strpos($huhw, DIRECTORY_SEPARATOR) !== false) { < $proposedtable=str_replace('>', '>' . $huhw . ' -j ' . $infile . ' ' . $outp . ' -png', $proposedtable); < exec($huhw . ' -j ' . $infile . ' ' . $outp . ' -png'); --- > $proposedtable=str_replace('>', '>/usr/local/bin/pdfimages -j ' . $infile . ' ' . $outp . ' -png', $proposedtable); > exec('/usr/local/bin/pdfimages -j ' . $infile . ' ' . $outp . ' -png'); 474,483d81 < if (1 == 1) { < putenv('PATH=/usr/local/bin'); < $proposedtable=str_replace('>', '>pdfimages -j ' . $infile . ' ' . $outp . ' -png', $proposedtable); < exec('pdfimages -j ' . $infile . ' ' . $outp . ' -png'); < } else { < $proposedtable=str_replace('>', '>/usr/local/bin/pdfimages -j ' . $infile . ' ' . $outp . ' -png', $proposedtable); < exec('/usr/local/bin/pdfimages -j ' . $infile . ' ' . $outp . ' -png'); < } < } < } else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { 487,493d84 < < $sofarw=0; < $vsw=0; < $padbr=''; < if (isset($_GET['sw'])) { < $vsw=$_GET['sw']; < } 495,502c86,87 < $datau='data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $filename)[-1 + sizeof(explode(".", $filename))])) . ';base64,' . base64_encode(file_get_contents($filename)); < $proposedtable=str_replace('', '', $proposedtable); < $proposedtable=str_replace('', '', $proposedtable); < list($width, $height, $type, $attr) = getimagesize($filename); < if ("$vsw" != "0" && ($sofarw + $width) > $vsw) { $padbr="
"; $sofarw=($width + 5); } else { $sofarw+=($width + 5); } < $proposedtable=str_replace('', $padbr . ' ', $proposedtable); < $padbr=''; < if ($outp != strtoupper($outp)) { unlink($filename); } --- > $datau='data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $filename)[-1 + sizeof(explode(".", $filename))])) . ';base64,' . base64_encode($filename); > $proposedtable=str_replace('', '', $proposedtable); 505c90 < echo str_replace($rest, $restto, $proposedtable); --- > echo $proposedtable;