Re: phptotext]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if there is only English word inside pdf, I can retrieve
text from pdf, but there are involved Japanese text inside
pdf, I got error and can not retrieve any text from pdf.

I would like to retrieve text from pdf. It is not necessarey to
retrieve Japanese text.



code-----------------------------------------------------------
$handle = popen("/usr/bin/pdftotext \"$original_tmp\" - -layout 2>&1", 'r');
$strbuf = fread($handle, 2048000);
echo $strbuf;// showing error message "Error: "
$strbuf = addslashes($strbuf);
pclose($handle);

$sql_insert = "INSERT INTO view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES ('$binaryContent','$original_name','$original_size','$original_type',CURTIME(),'$strbuf')";



Vicente wrote:
Yui wrote:


$handle = popen("/usr/bin/pdftotext \"$original_name\" - -layout ",'r');
$read = fread($handle, 2048000);
echo $read;
pclose($handle);
But I can not see anything!!
Please do help me!



$tmpfile = '/home/domain/public_html/pdf_files/myfile.pdf';
chmod ($tmpfile, 0777);
$salida = shell_exec("pdftotext /home/domain/public_html/pdf_files/$tmpfile 2>&1");

Here we assume pdftotext.exe is inside /home/domain/public_html/pdf_files/
Maybe you have this inside /usr/bin... etc. In this case be aware of
the security restrictions in your server when you try to execute a
program outside your secure environment.
If you have these problems then you can put the executable in the
same file's folder. No fear. It works.

Also, you can translate the  pdftotext error codes or messages to
japanese ^_^
if (ereg('some words in the console answer', $salida)) {
   print 'my message in jp';
}

etc..


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux